packages feed

base-prelude 0.1.15 → 0.1.16

raw patch · 2 files changed

+33/−4 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ BasePrelude: isSubsequenceOf :: Eq a => [a] -> [a] -> Bool
+ BasePrelude: uncons :: [a] -> Maybe (a, [a])

Files

base-prelude.cabal view
@@ -1,7 +1,7 @@ name:   base-prelude version:-  0.1.15+  0.1.16 synopsis:   The most complete prelude formed from only the "base" package description:
library/BasePrelude.hs view
@@ -9,12 +9,15 @@   -- * Reimplementations of functions presented in versions of \"base\" newer than 4.6   -- ** Data.Bool   bool,+  -- ** Data.Functor+  ($>),+  -- ** Data.List+  uncons,+  isSubsequenceOf,   -- ** Debug.Trace   traceShowId,   traceM,   traceShowM,-  -- ** Data.Functor-  ($>), ) where @@ -42,7 +45,7 @@ import Data.Int as Exports import Data.IORef as Exports import Data.Ix as Exports-import Data.List as Exports hiding (concat, foldr, foldl1, maximum, minimum, product, sum, all, and, any, concatMap, elem, foldl, foldr1, notElem, or, find, maximumBy, minimumBy, mapAccumL, mapAccumR, foldl')+import Data.List as Exports hiding (isSubsequenceOf, uncons, concat, foldr, foldl1, maximum, minimum, product, sum, all, and, any, concatMap, elem, foldl, foldr1, notElem, or, find, maximumBy, minimumBy, mapAccumL, mapAccumR, foldl') import Data.Maybe as Exports import Data.Monoid as Exports import Data.Ord as Exports@@ -121,3 +124,29 @@ -- | Flipped version of '<$'. ($>) :: Functor f => f a -> b -> f b ($>) = flip (<$)++-- | The 'isSubsequenceOf' function takes two lists and returns 'True' if the+-- first list is a subsequence of the second list.+--+-- @'isSubsequenceOf' x y@ is equivalent to @'elem' x ('subsequences' y)@.+--+-- ==== __Examples__+--+-- >>> isSubsequenceOf "GHC" "The Glorious Haskell Compiler"+-- True+-- >>> isSubsequenceOf ['a','d'..'z'] ['a'..'z']+-- True+-- >>> isSubsequenceOf [1..10] [10,9..0]+-- False+isSubsequenceOf :: (Eq a) => [a] -> [a] -> Bool+isSubsequenceOf []    _                    = True+isSubsequenceOf _     []                   = False+isSubsequenceOf a@(x:a') (y:b) | x == y    = isSubsequenceOf a' b+                               | otherwise = isSubsequenceOf a b++-- | Decompose a list into its head and tail. If the list is empty,+-- returns 'Nothing'. If the list is non-empty, returns @'Just' (x, xs)@,+-- where @x@ is the head of the list and @xs@ its tail.+uncons        :: [a] -> Maybe (a, [a])+uncons []     = Nothing+uncons (x:xs) = Just (x, xs)