summer 0.1.0.0 → 0.1.1.0
raw patch · 4 files changed
+22/−6 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Data.Summer: class Unmatch xs ys
- Data.Prodder: type family Consumer xs r
+ Data.Prodder: type family Replace x y xs
Files
- README.md +6/−0
- src/Data/Prodder.hs +11/−5
- src/Data/Summer.hs +4/−0
- summer.cabal +1/−1
README.md view
@@ -1,5 +1,9 @@ # summer +[](https://hackage.haskell.org/package/summer)+[](https://travis-ci.org/SamuelSchlesinger/summer)++ Extensible sums and products for Haskell. ```haskell@@ -21,3 +25,5 @@ a' :: Bool a' = consume y' (\b f -> b && f == 0.2) ```++This package is extremely experimental, and is subject to arbitrarily large changes.
src/Data/Prodder.hs view
@@ -25,11 +25,6 @@ module Data.Prodder ( -- * The extensible product type Prod- -- * Type families- , IndexIn- , HasIndexIn- , Consumer- , (<>) -- * Construction and deconstruction , extract , index@@ -37,6 +32,15 @@ , initN , dropFirst , Consume(consume, produce, extend1, cmap)+ -- * Type families+ , IndexIn+ , HasIndexIn+ , Consumer+ , (<>)+ , Length+ , Tail+ , Init+ , Replace -- * Rearranging and removing elements , Strengthen(strengthen) -- * Transforming extensible products@@ -67,10 +71,12 @@ Length '[] = 0 Length (x ': xs) = 1 + Length xs +-- | A type family for computing the tail of a type level list type family Tail n xs where Tail 0 xs = xs Tail n (x ': xs) = Tail (n - 1) xs +-- | A type family for computing the initial segment of a type level list type family Init n xs where Init 0 xs = '[] Init n (x ': xs) = x ': Init (n - 1) xs
src/Data/Summer.hs view
@@ -34,6 +34,7 @@ , inspect , consider , Match(match, override, unmatch)+ , Unmatch -- * Type families , TagIn , HasTagIn@@ -199,9 +200,12 @@ override r m = fmap (override @xs r) m {-# INLINE CONLIKE override #-} +-- | A utility typeclass which makes the implementation of 'Match' cleaner. class Unmatch xs ys where unmatchGo :: Matcher xs (Sum ys) -> Sum ys instance Unmatch '[] ys where unmatchGo = id+ {-# INLINE CONLIKE unmatchGo #-} instance (Unmatch xs ys, x `HasTagIn` ys) => Unmatch (x ': xs) ys where unmatchGo f = unmatchGo @xs (f (UnsafeInj (tag @x @ys) . unsafeCoerce @x))+ {-# INLINE CONLIKE unmatchGo #-}
summer.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: summer-version: 0.1.0.0+version: 0.1.1.0 synopsis: An implementation of extensible products and sums description: An implementation of extensible products and sums. license: MIT