exhaustive 1.1.2 → 1.1.3
raw patch · 3 files changed
+29/−4 lines, 3 filesdep ~basedep ~transformersPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, transformers
API changes (from Hackage documentation)
+ Control.Exhaustive: infixr 3 &:
Files
- Changelog.md +4/−0
- exhaustive.cabal +2/−2
- src/Control/Exhaustive.hs +23/−2
Changelog.md view
@@ -1,3 +1,7 @@+## 1.1.3++* Compile with base-4.9.+ ## 1.1.2 * Compile with generics-sop 0.2. Thanks to @kosmikus for this change.
exhaustive.cabal view
@@ -1,5 +1,5 @@ name: exhaustive-version: 1.1.2+version: 1.1.3 synopsis: Compile time checks that a computation considers producing data through all possible constructors description: For a brief tutorial to @exhaustive@, check out the documentation for "Control.Exhaustive", which contains a small example. homepage: http://github.com/ocharles/exhaustive@@ -21,7 +21,7 @@ exposed-modules: Control.Exhaustive -- other-modules: other-extensions: ConstraintKinds, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, RankNTypes, ScopedTypeVariables, TypeFamilies, TypeOperators, UndecidableInstances- build-depends: base >=4.7 && <4.9, generics-sop >=0.1 && <0.3, transformers >=0.3 && <0.5, template-haskell+ build-depends: base >=4.7 && <4.10, generics-sop >=0.1 && <0.3, transformers >=0.3 && <0.6, template-haskell hs-source-dirs: src default-language: Haskell2010 ghc-options: -Wall
src/Control/Exhaustive.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE PolyKinds #-}@@ -157,13 +158,33 @@ typeVars (_ : vs) = typeVars vs parentName :: Info -> Maybe ParentName-parentName (DataConI _ _ parent _) = Just parent+#if MIN_VERSION_template_haskell(2,11,0)+parentName (DataConI _ _ parent) =+#else+parentName (DataConI _ _ parent _) =+#endif+ Just parent parentName _ = Nothing +#if MIN_VERSION_template_haskell(2,11,0) constructors :: Name -> Q (Maybe [Con]) constructors t = do info <- reify t case info of+ TyConI (DataD _ _ _ _ ctors _) ->+ return (Just ctors)+ TyConI (NewtypeD _ _ _ _ ctor _) ->+ return (Just [ctor])+ TyConI (DataInstD _ _ _ _ ctors _) ->+ return (Just ctors)+ TyConI (NewtypeInstD _ _ _ _ ctor _) ->+ return (Just [ctor])+ _ -> return Nothing+#else+constructors :: Name -> Q (Maybe [Con])+constructors t =+ do info <- reify t+ case info of TyConI (DataD _ _ _ ctors _) -> return (Just ctors) TyConI (NewtypeD _ _ _ ctor _) ->@@ -173,7 +194,7 @@ TyConI (NewtypeInstD _ _ _ ctor _) -> return (Just [ctor]) _ -> return Nothing-+#endif -- | 'con' builds a 'Construction' for a single constructor of a data type. -- Unfortunately, as this function is used via Template Haskell, the type