strict-list 0.1.4 → 0.1.5
raw patch · 3 files changed
+21/−3 lines, 3 filesdep +hashablePVP ok
version bump matches the API change (PVP)
Dependencies added: hashable
API changes (from Hackage documentation)
+ StrictList: instance Data.Hashable.Class.Hashable a => Data.Hashable.Class.Hashable (StrictList.List a)
+ StrictList: match :: result -> (element -> List element -> result) -> List element -> result
Files
- library/StrictList.hs +14/−0
- library/StrictList/Prelude.hs +4/−0
- strict-list.cabal +3/−3
library/StrictList.hs view
@@ -87,6 +87,8 @@ mzero = empty mplus = (<|>) +instance Hashable a => Hashable (List a)+ {-| Reverse the list. -}@@ -255,6 +257,18 @@ in loop prefix prefix Nil tail Nil -> (suffix, confirmedPrefix) in loop Nil Nil Nil++{-|+Pattern match on list using functions.++Allows to achieve all the same as `uncons` only without intermediate `Maybe`.++Essentially provides the same functionality as `either` for `Either` and `maybe` for `Maybe`.+-}+match :: result -> (element -> List element -> result) -> List element -> result+match nil cons = \ case+ Cons head tail -> cons head tail+ Nil -> nil {-| Get the first element and the remainder of the list if it's not empty.
library/StrictList/Prelude.hs view
@@ -86,3 +86,7 @@ import Data.Semigroup.Foldable as Exports import Data.Semigroup.Traversable as Exports import Data.Semigroupoid as Exports++-- hashable+-------------------------+import Data.Hashable as Exports (Hashable)
strict-list.cabal view
@@ -1,5 +1,5 @@ name: strict-list-version: 0.1.4+version: 0.1.5 synopsis: Strict linked list description: Implementation of strict linked list with care taken about stack.@@ -27,6 +27,7 @@ StrictList.Prelude build-depends: base >=4.9 && <5,+ hashable >=1.2 && <2, semigroupoids >=5.3 && <6 test-suite test@@ -34,8 +35,7 @@ hs-source-dirs: test default-extensions: BangPatterns, DeriveDataTypeable, DeriveGeneric, DeriveFunctor, DeriveTraversable, FlexibleContexts, FlexibleInstances, LambdaCase, NoImplicitPrelude, RankNTypes, ScopedTypeVariables, StandaloneDeriving, TypeApplications, TypeFamilies default-language: Haskell2010- main-is:- Main.hs+ main-is: Main.hs build-depends: strict-list, QuickCheck >=2.8.1 && <3,