packages feed

exhaustive 1.1.6 → 1.1.7

raw patch · 3 files changed

+28/−14 lines, 3 filesdep ~basedep ~generics-sopdep ~template-haskell

Dependency ranges changed: base, generics-sop, template-haskell

Files

Changelog.md view
@@ -1,3 +1,13 @@+## 1.1.7 -- 2018-10-23++### Other Changes++* Changed bounds of `template-haskell` to only support 2.14.0.0. This release is+  thus only compatible with GHC 8.6. If this is a problem, please open an issue+  and I can add CPP to support older GHCs.++* Increased upper-bound of `base` to < 4.13.+ ## 1.1.6  ### Other Changes
exhaustive.cabal view
@@ -1,5 +1,5 @@ name:                exhaustive-version:             1.1.6+version:             1.1.7 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,10 +21,10 @@   exposed-modules:     Control.Exhaustive   -- other-modules:   other-extensions:    ConstraintKinds, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, RankNTypes, ScopedTypeVariables, TypeFamilies, TypeOperators, UndecidableInstances-  build-depends:       base >=4.7 && <4.12-                     , generics-sop >=0.1 && <0.4+  build-depends:       base >=4.7 && <4.13+                     , generics-sop >=0.1 && <0.5                      , transformers >=0.3 && <0.6-                     , template-haskell+                     , template-haskell >= 2.14.0.0 && < 2.15.0.0   hs-source-dirs:      src   default-language:    Haskell2010   ghc-options: -Wall
src/Control/Exhaustive.hs view
@@ -140,17 +140,21 @@ -- To create and use 'ConstructorApplication's, use '&:'. type ConstructorApplication f code = Injection (NP I) code -.-> K (f (NS (NP I) code)) -name :: Con -> Name-name (NormalC n _) = n-name (RecC n _) = n-name (InfixC _ n _) = n-name (ForallC _ _ c) = name c+names :: Con -> [Name]+names (NormalC n _) = [n]+names (RecC n _) = [n]+names (InfixC _ n _) = [n]+names (ForallC _ _ c) = names c+names (GadtC n _ _) = n+names (RecGadtC n _ _) = n  conFields :: Con -> [Type] conFields (NormalC _ f) = map snd f conFields (RecC _ f) = map (\(_, _, t) -> t) f conFields (InfixC l _ r) = map snd [l,r] conFields (ForallC _ _ c) = conFields c+conFields (GadtC _ f _) = map snd f+conFields (RecGadtC _ f _) = map (\(_, _, t) -> t) f  typeVars :: [Type] -> [Name] typeVars [] = []@@ -220,7 +224,7 @@      ctors <- maybe (fail ("Unable to determine constructors of " ++ show parent)) return =<<               constructors parent      let matching =-           filter ((ctorName ==) . name . snd)+           filter ((ctorName `elem`) . names . snd)                   (zip [0 ..] ctors)      case matching of        [] ->@@ -228,9 +232,9 @@        ((i,c):_) ->          let fieldTypes = conFields c              lambda =-               (do names <- sequence ((newName "x") <$-                                      fieldTypes)-                   return (LamE (VarP <$> names)+               (do ns <- sequence ((newName "x") <$+                                   fieldTypes)+                   return (LamE (VarP <$> ns)                                 (AppE (ConE 'Construction)                                       (foldr (\x y ->                                                 InfixE (Just x)@@ -239,7 +243,7 @@                                              (ConE 'Nil)                                              (map (AppE (ConE 'I) .                                                    VarE)-                                                  names)))))+                                                  ns)))))              lType =                (pure (ForallT (map PlainTV (typeVars fieldTypes))                               []