prologue 3.1.3 → 3.1.4
raw patch · 2 files changed
+16/−2 lines, 2 files
Files
- prologue.cabal +3/−2
- src/Data/List/Utils.hs +13/−0
prologue.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 6bf442b119d920bdb4e10b74b62f5eb4ae96bb065d13b1d1758bc3b2cfa1515b+-- hash: 0d3ce02fd563a6feeecf96713b122417c0e8937b206c68d86e9442b066041809 name: prologue-version: 3.1.3+version: 3.1.4 synopsis: Better, more general Prelude exporting common utilities. description: Replacement for the Haskell's Prelude, exposing more commonly used functions and patching old GHC ones to behave in the newest GHC's way. category: control@@ -67,6 +67,7 @@ , vector exposed-modules: Data.Default.Instances.Missing+ Data.List.Utils Data.String.Class Data.Tuple.Curry.Total Data.Typeable.Proxy.Abbr
+ src/Data/List/Utils.hs view
@@ -0,0 +1,13 @@+module Data.List.Utils where++import Prelude++class SplitOn s a where+ splitOn :: s -> a -> [a]++instance Eq a => SplitOn a [a] where+ splitOn t = reverse . fmap reverse . go [] [] where+ go done current = \case+ [] -> (if null current then id else (current:)) $ done+ (a:as) -> if a == t then go (current:done) [] as+ else go done (a:current) as