acc 0.1.3.1 → 0.2
raw patch · 3 files changed
+20/−9 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Acc: instance GHC.Generics.Generic (Acc.Acc a)
- Acc: instance GHC.Generics.Generic1 Acc.Acc
- Acc: unsnoc :: Acc a -> Maybe (a, Acc a)
Files
- acc.cabal +1/−1
- library/Acc.hs +8/−4
- library/Acc/NeAcc/Def.hs +11/−4
acc.cabal view
@@ -1,5 +1,5 @@ name: acc-version: 0.1.3.1+version: 0.2 synopsis: Sequence optimized for monoidal construction and folding description: Data structure intended for accumulating a sequence of elements
library/Acc.hs view
@@ -3,7 +3,6 @@ cons, snoc, uncons,- unsnoc, toNonEmpty, toNeAcc, enumFromTo,@@ -39,11 +38,16 @@ data Acc a = EmptyAcc | TreeAcc !(NeAcc.NeAcc a)- deriving (Generic, Generic1) -instance NFData a => NFData (Acc a)+instance NFData a => NFData (Acc a) where+ rnf = \case+ TreeAcc tree -> rnf tree+ EmptyAcc -> () -instance NFData1 Acc+instance NFData1 Acc where+ liftRnf rnfLeaf = \case+ TreeAcc tree -> liftRnf rnfLeaf tree+ EmptyAcc -> () deriving instance Functor Acc
library/Acc/NeAcc/Def.hs view
@@ -18,17 +18,24 @@ -- -- Relates to 'Acc.Acc' the same way as 'NonEmpty' to list. data NeAcc a- = Leaf !a+ = Leaf a | Branch !(NeAcc a) !(NeAcc a)- deriving (Generic, Generic1) instance Show a => Show (NeAcc a) where show = show . toList -instance NFData a => NFData (NeAcc a)+instance NFData a => NFData (NeAcc a) where+ rnf = \case+ Leaf a -> rnf a+ Branch l r -> seq (rnf l) (rnf r) -instance NFData1 NeAcc+instance NFData1 NeAcc where+ liftRnf rnfLeaf = rnfTree+ where+ rnfTree = \case+ Leaf a -> rnfLeaf a+ Branch l r -> seq (rnfTree l) (rnfTree r) instance IsList (NeAcc a) where type Item (NeAcc a) = a