diff options
| author | Albert Krewinkel <albert@zeitkraut.de> | 2022-03-13 16:42:30 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-13 08:42:30 -0700 |
| commit | 1aeeba9ecb7fc79062c16e00536ec8500632aab2 (patch) | |
| tree | 4404f80eb80797dd729e4ad34ff61dd297d1e936 /src | |
| parent | edfe34c86c595f253467304ab54061a56cf5045b (diff) | |
Shared: define ordNub as alias for nubOrd from containers package (#7963)
This requires at least containers 0.6.0.1, which ships with the oldest
GHC version currently supported by pandoc (GHC 8.6).
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Shared.hs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 26c922a04..95a422287 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -105,6 +105,7 @@ import qualified Data.Bifunctor as Bifunctor import Data.Char (isAlpha, isLower, isSpace, isUpper, toLower, isAlphaNum, generalCategory, GeneralCategory(NonSpacingMark, SpacingCombiningMark, EnclosingMark, ConnectorPunctuation)) +import Data.Containers.ListUtils (nubOrd) import Data.List (find, intercalate, intersperse, sortOn, foldl') import qualified Data.Map as M import Data.Maybe (mapMaybe, fromMaybe) @@ -174,14 +175,12 @@ splitAt' n xs | n <= 0 = ([],xs) splitAt' n (x:xs) = (x:ys,zs) where (ys,zs) = splitAt' (n - charWidth x) xs +-- | Remove duplicates from a list. ordNub :: (Ord a) => [a] -> [a] -ordNub l = go Set.empty l - where - go _ [] = [] - go s (x:xs) = if x `Set.member` s then go s xs - else x : go (Set.insert x s) xs +ordNub = nubOrd +{-# INLINE ordNub #-} --- | Returns the last element in a foldable structure for that the +-- | Returns the first element in a foldable structure for that the -- monadic predicate holds true, and @Nothing@ if no such element -- exists. findM :: forall m t a. (Monad m, Foldable t) |
