Commit 9066a0bf authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] perf issue with List related with #218 (thx @np)

parent b22297b8
module Gargantext.Utils.List where module Gargantext.Utils.List where
import Data.Ord (class Ord, comparing) import Data.Ord (class Ord, comparing)
import Data.List as List import Data.List as List
import Data.Array as Array
import Gargantext.Prelude
-- same as -- same as
-- https://github.com/purescript/purescript-arrays/blob/v5.3.1/src/Data/Array.purs#L715-L715 -- https://github.com/purescript/purescript-arrays/blob/v5.3.1/src/Data/Array.purs#L715-L715
sortWith :: forall a b. Ord b => (a -> b) -> List.List a -> List.List a sortWith :: forall a b. Ord b => (a -> b) -> List.List a -> List.List a
sortWith f = List.sortBy (comparing f) sortWith f l = Array.toUnfoldable $ Array.sortBy (comparing f) $ Array.fromFoldable l
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment