Skip to content

Commit 8708e03

Browse files
use containers nubOrd
1 parent 708f101 commit 8708e03

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

src/Constrained/Core.hs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ module Constrained.Core (
2222
NonEmpty ((:|)),
2323
Evidence (..),
2424
unionWithMaybe,
25-
nubOrd,
2625
) where
2726

2827
import Constrained.List (
@@ -130,14 +129,3 @@ instance Typeable c => Show (Evidence c) where
130129
-- | Take the union of two `Maybe` values with a given union operator
131130
unionWithMaybe :: (a -> a -> a) -> Maybe a -> Maybe a -> Maybe a
132131
unionWithMaybe f ma ma' = (f <$> ma <*> ma') <|> ma <|> ma'
133-
134-
-- | Strip out duplicates (in n-log(n) time, by building an intermediate Set)
135-
nubOrd :: Ord a => [a] -> [a]
136-
nubOrd =
137-
loop mempty
138-
where
139-
loop _ [] = []
140-
loop s (a : as)
141-
| a `Set.member` s = loop s as
142-
| otherwise =
143-
let s' = Set.insert a s in s' `seq` a : loop s' as

src/Constrained/NumOrd.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@ module Constrained.NumOrd (
5656
import Constrained.AbstractSyntax
5757
import Constrained.Base
5858
import Constrained.Conformance
59-
import Constrained.Core (Value (..), unionWithMaybe, nubOrd)
59+
import Constrained.Core (Value (..), unionWithMaybe)
6060
import Constrained.FunctionSymbol
6161
import Constrained.GenT
6262
import Constrained.Generic
6363
import Constrained.List
6464
import Constrained.PrettyUtils
6565
import Control.Applicative ((<|>))
6666
import Control.Arrow (first)
67+
import Data.Containers.ListUtils
6768
import Data.Foldable
6869
import Data.Kind
6970
import Data.List (nub)

0 commit comments

Comments
 (0)