compdata 0.4 → 0.4.1
raw patch · 6 files changed
+26/−9 lines, 6 filesdep −Stream
Dependencies removed: Stream
Files
- compdata.cabal +2/−2
- src/Data/Comp/MultiParam/Derive/Equality.hs +2/−1
- src/Data/Comp/MultiParam/Derive/Show.hs +2/−1
- src/Data/Comp/Param/Derive/Equality.hs +2/−1
- src/Data/Comp/Param/Derive/Show.hs +2/−1
- src/Data/Comp/Zippable.hs +16/−3
compdata.cabal view
@@ -1,5 +1,5 @@ Name: compdata-Version: 0.4+Version: 0.4.1 Synopsis: Compositional Data Types Description: @@ -274,7 +274,7 @@ Data.Comp.MultiParam.Derive.Injections, Data.Comp.MultiParam.Derive.Projections - Build-Depends: base == 4.*, template-haskell, containers, mtl, QuickCheck >= 2, derive, deepseq, th-expand-syns, transformers, Stream+ Build-Depends: base == 4.*, template-haskell, containers, mtl, QuickCheck >= 2, derive, deepseq, th-expand-syns, transformers hs-source-dirs: src ghc-options: -W if flag(benchmark)
src/Data/Comp/MultiParam/Derive/Equality.hs view
@@ -43,7 +43,8 @@ else [clause [wildP,wildP] (normalB [|return False|]) []] eqHDDecl <- funD 'eqHD (map (eqHDClause conArg coArg) constrs' ++ defC)- return [InstanceD [] classType [eqHDDecl]]+ let context = map (\arg -> ClassP ''Eq [arg]) argNames+ return [InstanceD context classType [eqHDDecl]] where eqHDClause :: Name -> Name -> (Name,[Type]) -> ClauseQ eqHDClause conArg coArg (constr, args) = do varXs <- newNames (length args) "x"
src/Data/Comp/MultiParam/Derive/Show.hs view
@@ -48,7 +48,8 @@ let classType = AppT (ConT ''ShowHD) complType constrs' :: [(Name,[Type])] <- mapM normalConExp constrs showHDDecl <- funD 'showHD (map (showHDClause conArg coArg) constrs')- return [InstanceD [] classType [showHDDecl]]+ let context = map (\arg -> ClassP ''Show [arg]) argNames+ return [InstanceD context classType [showHDDecl]] where showHDClause :: Name -> Name -> (Name,[Type]) -> ClauseQ showHDClause conArg coArg (constr, args) = do varXs <- newNames (length args) "x"
src/Data/Comp/Param/Derive/Equality.hs view
@@ -49,7 +49,8 @@ else [clause [wildP,wildP] (normalB [|return False|]) []] eqDDecl <- funD 'eqD (map (eqDClause conArg coArg) constrs' ++ defC)- return [InstanceD [] classType [eqDDecl]]+ let context = map (\arg -> ClassP ''Eq [arg]) argNames+ return [InstanceD context classType [eqDDecl]] where eqDClause :: Name -> Name -> (Name,[Type]) -> ClauseQ eqDClause conArg coArg (constr, args) = do varXs <- newNames (length args) "x"
src/Data/Comp/Param/Derive/Show.hs view
@@ -54,7 +54,8 @@ -- constrs' = [(X,[c]), (Y,[a,c]), (Z,[b -> c])] constrs' :: [(Name,[Type])] <- mapM normalConExp constrs showDDecl <- funD 'showD (map (showDClause conArg coArg) constrs')- return [InstanceD [] classType [showDDecl]]+ let context = map (\arg -> ClassP ''Show [arg]) argNames+ return [InstanceD context classType [showDDecl]] where showDClause :: Name -> Name -> (Name,[Type]) -> ClauseQ showDClause conArg coArg (constr, args) = do varXs <- newNames (length args) "x"
src/Data/Comp/Zippable.hs view
@@ -11,10 +11,23 @@ -------------------------------------------------------------------------------- module Data.Comp.Zippable- ( module Data.Comp.Zippable- , module Data.Stream ) where+ ( Zippable+ , Numbered(..)+ , unNumbered+ , number+ , number'+ , Stream(..)+ , (<:>)) where -import Data.Stream (Stream(..), (<:>))+-- import Data.Stream (Stream(..), (<:>))++data Stream a = Cons a (Stream a) deriving (Eq, Ord)++infixr 5 <:>+-- | The @ \<:\> @ operator is an infix version of the 'Cons'+-- constructor.+(<:>) :: a -> Stream a -> Stream a+(<:>) = Cons -- | Instances of this class provide a generalisation of the zip -- function on the list functor.