packages feed

catamorphism 0.5.1.0 → 0.6.0.0

raw patch · 2 files changed

+23/−7 lines, 2 filesdep ~basedep ~template-haskellPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, template-haskell

API changes (from Hackage documentation)

- Data.Morphism.Cata: cataName :: CataOptions -> String
+ Data.Morphism.Cata: [cataName] :: CataOptions -> String

Files

catamorphism.cabal view
@@ -1,5 +1,5 @@ name:                catamorphism-version:             0.5.1.0+version:             0.6.0.0 synopsis:            A package exposing a helper function for generating catamorphisms. description:         A package exposing a helper function for generating catamorphisms. homepage:            https://github.com/frerich/catamorphism@@ -8,7 +8,7 @@ author:              Frerich Raabe maintainer:          frerich.raabe@gmail.com bug-reports:         https://github.com/frerich/catamorphism/issues-copyright:           Copyright (c) 2014, 2015 Frerich Raabe <frerich.raabe@gmail.com>+copyright:           Copyright (c) 2014, 2015, 2016, 2017, 2018 Frerich Raabe <frerich.raabe@gmail.com> category:            Development build-type:          Simple cabal-version:       >=1.10@@ -20,7 +20,7 @@  library   exposed-modules:     Data.Morphism.Cata-  build-depends:       base >=4.6 && <4.9, template-haskell >=2.8 && <2.11+  build-depends:       base >=4.6 && <4.11, template-haskell >=2.8 && <2.13   hs-source-dirs:      src   default-language:    Haskell2010   ghc-options:         -Wall
src/Data/Morphism/Cata.hs view
@@ -62,6 +62,7 @@ > numVars = cataExpr (const 1) (const 0) (+) -} +{-# LANGUAGE CPP #-} module Data.Morphism.Cata     ( CataOptions(..)     , defaultOptions@@ -113,12 +114,22 @@ conArgTypes (RecC _ args)        = map (\(_,_,x) -> x) args conArgTypes (InfixC arg1 _ arg2) = map snd [arg1, arg2] conArgTypes (ForallC _ _ c)      = conArgTypes c+#if MIN_VERSION_template_haskell(2,11,0)+conArgTypes (GadtC _ args _)     = map snd args+conArgTypes (RecGadtC _ args _)  = map (\(_,_,x) -> x) args+#endif  conName :: Con -> Name-conName (NormalC n _)   = n-conName (RecC n _)      = n-conName (InfixC _ n _)  = n-conName (ForallC _ _ c) = conName c+conName (NormalC n _)    = n+conName (RecC n _)       = n+conName (InfixC _ n _)   = n+conName (ForallC _ _ c)  = conName c+-- How to handle these? Both constructor types take a list of names - which+-- (if any) of them should we pick?+#if MIN_VERSION_template_haskell(2,11,0)+conName (GadtC _ _ _)    = undefined+conName (RecGadtC _ _ _) = undefined+#endif  typeName :: Type -> Maybe Name typeName (AppT t _) = typeName t@@ -142,8 +153,13 @@ makeCata opts ty = do     typeInfo <- reify ty     (tyVarBndrs, cons) <- case typeInfo of+#if MIN_VERSION_template_haskell(2,11,0)+            TyConI (DataD _ _ tyVarBndrs _ cons _)   -> return (tyVarBndrs, cons)+            TyConI (NewtypeD _ _ tyVarBndrs _ con _) -> return (tyVarBndrs, [con])+#else             TyConI (DataD _ _ tyVarBndrs cons _)   -> return (tyVarBndrs, cons)             TyConI (NewtypeD _ _ tyVarBndrs con _) -> return (tyVarBndrs, [con])+#endif             _                                      -> fail "makeCata: Expected name of type constructor"     sequence [signature tyVarBndrs cons, funDef cons]   where