pointless-haskell 0.0.8 → 0.0.9
raw patch · 3 files changed
+13/−14 lines, 3 files
Files
- pointless-haskell.cabal +1/−1
- src/Generics/Pointless/Examples/Examples.hs +9/−1
- src/Generics/Pointless/Functors.hs +3/−12
pointless-haskell.cabal view
@@ -1,5 +1,5 @@ Name: pointless-haskell-Version: 0.0.8+Version: 0.0.9 License: BSD3 License-file: LICENSE Author: Alcino Cunha <alcino@di.uminho.pt>, Hugo Pacheco <hpacheco@di.uminho.pt>
src/Generics/Pointless/Examples/Examples.hs view
@@ -524,10 +524,18 @@ -- ** Summation --- | Definition of inter addition as a catamorphism.+-- | Definition of integerr addition as a catamorphism. sumCata :: [Int] -> Int sumCata = cata (ann::Ann [Int]) f where f = (0!) \/ add++-- | Definition of integerr addition as an accumulation.+sumAccum :: ([Int],Int) -> Int+sumAccum = accum _L f tau where+ tau (Left _,b) = Left _L+ tau (Right (x,xs),b) = Right (x,(xs,x+b))+ f (Left _,b) = b+ f (Right (x,c),b) = c -- ** Multiplication
src/Generics/Pointless/Functors.hs view
@@ -38,24 +38,15 @@ -- | Sum of functors. infixr 5 :+:-data (g :+: h) x = InlF (g x) | InrF (h x) deriving (Eq,Show)--instance (G.Typeable (g x),G.Typeable (h x)) => G.Typeable ((g :+: h) x) where- typeOf _ = G.mkTyCon ":+:" `G.mkTyConApp` [G.typeOf (ann::g x),G.typeOf (ann::h x)]+data (g :+: h) x = InlF (g x) | InrF (h x) deriving (Eq,Show,G.Typeable) -- | Product of functors. infixr 6 :*:-data (g :*: h) x = ProdF (g x) (h x) deriving (Eq,Show)--instance (G.Typeable (g x),G.Typeable (h x)) => G.Typeable ((g :*: h) x) where- typeOf _ = G.mkTyCon ":*:" `G.mkTyConApp` [G.typeOf (ann::g x),G.typeOf (ann::h x)]+data (g :*: h) x = ProdF (g x) (h x) deriving (Eq,Show,G.Typeable) -- | Composition of functors. infixr 9 :@:-data (g :@: h) x = CompF {unCompF :: g (h x)} deriving (Eq,Show)--instance (G.Typeable (g x),G.Typeable (h x)) => G.Typeable ((g :@: h) x) where- typeOf _ = G.mkTyCon ":@:" `G.mkTyConApp` [G.typeOf (ann::g x),G.typeOf (ann::h x)]+data (g :@: h) x = CompF {unCompF :: g (h x)} deriving (Eq,Show,G.Typeable) -- | Explicit fixpoint operator. newtype Fix f = Inn { -- | The unfolding of the fixpoint of a functor is the functor applied to its fixpoint.