data-combinator-gen 0.1.0.1 → 0.1.0.2
raw patch · 5 files changed
+27/−10 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- data-combinator-gen.cabal +1/−1
- examples/Cp.hs +4/−4
- examples/Main.hs +17/−4
- src/Data/Combinators/TH.hs +1/−1
CHANGELOG.md view
@@ -2,6 +2,10 @@ ## 0.1.0.1 -- YYYY-mm-dd +* Corrected recursion on (,) - it's now right recursive++## 0.1.0.1 -- YYYY-mm-dd+ * Added newtype support ## 0.1.0.0 -- YYYY-mm-dd
data-combinator-gen.cabal view
@@ -13,7 +13,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.1.0.1+version: 0.1.0.2 -- A short (one-line) description of the package. synopsis: Generate a special combinator from any data type.
examples/Cp.hs view
@@ -1,11 +1,11 @@ {-# LANGUAGE TypeOperators #-} --- (c) MP-I (1998/9-2006/7) and CP (2005/6-2017/8)+-- (c) MP-I (1998/9-2006/7) and CP (2005/6-2018/9) module Cp where -infixl 4 ><-infixl 5 -|-+infixl 5 ><+infixl 4 -|- -- (1) Product ----------------------------------------------------------------- @@ -123,7 +123,7 @@ distl :: ((c -|- a) >< b) -> (c >< b) -|- (a >< b) distl = uncurry (either (curry i1) (curry i2)) -distr :: (b >< c -|- a) -> (b >< c) -|- (b >< a)+distr :: (b >< (c -|- a)) -> (b >< c) -|- (b >< a) distr = (swap -|- swap) . distl . swap -- (6) Class bifunctor ---------------------------------------------------------
examples/Main.hs view
@@ -1,17 +1,27 @@ {-# LANGUAGE KindSignatures, TypeFamilies, DeriveFunctor, DeriveTraversable,- DeriveFoldable #-}+ DeriveFoldable, TypeOperators #-} module Main where import Data.Combinators.TH-import Cp -- Program Calculus Combinators library-import Data.Functor.Foldable -- Recursion schemes library-import Data.Functor.Foldable.TH -- Recursion schemes makeBaseFunctor+--import Cp -- Program Calculus Combinators library+--import Data.Functor.Foldable -- Recursion schemes library+--import Data.Functor.Foldable.TH -- Recursion schemes makeBaseFunctor import Data.List (foldl') import Data.Functor.Compose makeCombinator ''Compose +newtype Fix f = Fix { unFix :: f (Fix f) }++data Tree a = Leaf String | Node [a] deriving (Functor)+type Hash = Int+type PartiallySubstantiatedMerkleTree = Fix (((,) Hash) `Compose` Maybe `Compose` Tree)++makeCombinator ''Fix++{-+ makeCombinator ''ListF l :: [a] -> Integer@@ -60,6 +70,9 @@ makeCombinator ''B -} +-}+ main :: IO () main = undefined+
src/Data/Combinators/TH.hs view
@@ -73,7 +73,7 @@ applyConVars :: [ExpQ] -> t -> [a] -> Int -> ExpQ applyConVars _ _ [] _ = conE (mkName "()") applyConVars varsC _ [_] n = varsC !! n-applyConVars varsC name' (_:fs) n = tupE (applyConVars varsC name' fs (n-1) : [varsC !! n])+applyConVars varsC name' (_:fs) n = tupE ([varsC !! n] ++ [applyConVars varsC name' fs (n-1)]) ------