packages feed

unbound-generics 0.4.0 → 0.4.1

raw patch · 7 files changed

+45/−50 lines, 7 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Unbound.Generics.LocallyNameless.Alpha: instance Unbound.Generics.LocallyNameless.Alpha.Alpha a => Unbound.Generics.LocallyNameless.Alpha.Alpha (GHC.Base.Maybe a)
- Unbound.Generics.LocallyNameless.Subst: instance Unbound.Generics.LocallyNameless.Subst.Subst c a => Unbound.Generics.LocallyNameless.Subst.Subst c (GHC.Base.Maybe a)
+ Unbound.Generics.LocallyNameless.Alpha: instance Unbound.Generics.LocallyNameless.Alpha.Alpha a => Unbound.Generics.LocallyNameless.Alpha.Alpha (GHC.Maybe.Maybe a)
+ Unbound.Generics.LocallyNameless.Embed: -- | The term type embedded in the embedding <tt>e</tt>
+ Unbound.Generics.LocallyNameless.Fresh: instance Control.Monad.Fail.MonadFail m => Control.Monad.Fail.MonadFail (Unbound.Generics.LocallyNameless.Fresh.FreshMT m)
+ Unbound.Generics.LocallyNameless.LFresh: instance Control.Monad.Fail.MonadFail m => Control.Monad.Fail.MonadFail (Unbound.Generics.LocallyNameless.LFresh.LFreshMT m)
+ Unbound.Generics.LocallyNameless.Operations: -- | The term type embedded in the embedding <tt>e</tt>
+ Unbound.Generics.LocallyNameless.Subst: instance Unbound.Generics.LocallyNameless.Subst.Subst c a => Unbound.Generics.LocallyNameless.Subst.Subst c (GHC.Maybe.Maybe a)
- Unbound.Generics.LocallyNameless.Alpha: DisjointSet :: (Maybe [a]) -> DisjointSet a
+ Unbound.Generics.LocallyNameless.Alpha: DisjointSet :: Maybe [a] -> DisjointSet a
- Unbound.Generics.LocallyNameless.Alpha: NamePatFind :: AnyName -> Either Integer Integer -> NamePatFind
+ Unbound.Generics.LocallyNameless.Alpha: NamePatFind :: (AnyName -> Either Integer Integer) -> NamePatFind
- Unbound.Generics.LocallyNameless.Alpha: NthPatFind :: Integer -> Either Integer AnyName -> NthPatFind
+ Unbound.Generics.LocallyNameless.Alpha: NthPatFind :: (Integer -> Either Integer AnyName) -> NthPatFind
- Unbound.Generics.LocallyNameless.Operations: TRec :: (Bind (Rec p) ()) -> TRec p
+ Unbound.Generics.LocallyNameless.Operations: TRec :: Bind (Rec p) () -> TRec p
- Unbound.Generics.LocallyNameless.Rec: TRec :: (Bind (Rec p) ()) -> TRec p
+ Unbound.Generics.LocallyNameless.Rec: TRec :: Bind (Rec p) () -> TRec p
- Unbound.Generics.LocallyNameless.Subst: [SubstName] :: (a ~ b) => Name a -> SubstName a b
+ Unbound.Generics.LocallyNameless.Subst: [SubstName] :: a ~ b => Name a -> SubstName a b
- Unbound.Generics.PermM: Perm :: (Map a a) -> Perm a
+ Unbound.Generics.PermM: Perm :: Map a a -> Perm a

Files

Changelog.md view
@@ -1,5 +1,11 @@ # NEXT +# 0.4.1++* Add `MonadFail` instances for `LFreshMT` and `FreshMT`++* Builds with GHC 8.10+ # 0.4.0  * New binding specification type `Ignore`.
− examples/Prof.hs
@@ -1,42 +0,0 @@-{-# language GADTs, RankNTypes #-}-module Prof where--import Data.Profunctor--data Shop a b s t where-  Shop :: (s -> a) -> (s -> b -> t) -> Shop a b s t--type Optic p s t a b  = p a b -> p s t-type Lens s t a b = forall p . (Strong p) => Optic p s t a b--lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b-lens get set pab = dimap (\s -> (s, get s)) (uncurry set) (second' pab)--instance Profunctor (Shop a b) where-  dimap f g (Shop get set) = Shop (get . f) (\s -> g . set (f s))--instance Strong (Shop a b) where-   first' (Shop get set) = Shop (get . fst) (\(s,c) b -> (set s b, c))--withLens :: Lens s t a b -> ((s -> a) -> (s -> b -> t) -> r) -> r-withLens l k = case l (Shop id (const id)) of-                 Shop getter setter -> k getter setter---type Prism s t a b = forall p . (Choice p) => Optic p s t a b--prism :: (s -> Either t a) -> (b -> t) -> Prism s t a b-prism view review pab = dimap view (either id review) (right' pab)--data Market a b s t where-  Market :: (s -> Either t a) -> (b -> t) -> Market a b s t--instance Profunctor (Market a b) where-  dimap f g (Market view review) = Market (either (Left . g) Right . (view . f)) (g . review)--instance Choice (Market a b) where-  left' (Market view review) = Market (either (either (Left . Left) Right . view) (Left . Right)) (Left . review)--withPrism :: Prism s t a b -> ((s -> Either t a) -> (b -> t) -> r) -> r-withPrism l k = case l (Market Right id) of-                  Market view review -> k view review
src/Unbound/Generics/LocallyNameless/Fresh.hs view
@@ -8,6 +8,7 @@ -- Global freshness monad. {-# LANGUAGE CPP, GeneralizedNewtypeDeriving,              FlexibleInstances, MultiParamTypeClasses,+             StandaloneDeriving,              UndecidableInstances   #-} -- (we expect deprecation warnings about Control.Monad.Trans.Error)@@ -20,6 +21,9 @@ import Control.Monad.Identity  import Control.Monad.Catch (MonadThrow, MonadCatch, MonadMask)+#if MIN_VERSION_base(4,9,0)+import qualified Control.Monad.Fail as Fail+#endif import Control.Monad.Trans import Control.Monad.Trans.Except import Control.Monad.Trans.Error@@ -66,6 +70,10 @@     , MonadCatch     , MonadMask     )++#if MIN_VERSION_base(4,9,0)+deriving instance Fail.MonadFail m => Fail.MonadFail (FreshMT m)+#endif  -- | Run a 'FreshMT' computation (with the global index starting at zero). runFreshMT :: Monad m => FreshMT m a -> m a
src/Unbound/Generics/LocallyNameless/LFresh.hs view
@@ -45,6 +45,7 @@              , GeneralizedNewtypeDeriving              , FlexibleInstances              , MultiParamTypeClasses+             , StandaloneDeriving              , UndecidableInstances #-} module Unbound.Generics.LocallyNameless.LFresh        (@@ -64,6 +65,9 @@ import Data.Typeable (Typeable)  import Control.Monad.Catch (MonadThrow, MonadCatch, MonadMask)+#if MIN_VERSION_base(4,9,0)+import qualified Control.Monad.Fail as Fail+#endif import Control.Monad.Reader import Control.Monad.Identity import Control.Applicative (Applicative, Alternative)@@ -115,6 +119,10 @@     , MonadCatch     , MonadMask     )++#if MIN_VERSION_base(4,9,0)+deriving instance Fail.MonadFail m => Fail.MonadFail (LFreshMT m)+#endif  -- | Run an 'LFreshMT' computation in an empty context. runLFreshMT :: LFreshMT m a -> m a
src/Unbound/Generics/LocallyNameless/Name.hs view
@@ -35,7 +35,7 @@ -- type @a@.  The type @a@ is used as a tag to distinguish these names -- from names that may stand for other sorts of terms. ----- Two names in a term are consider+-- Two names in a term are considered -- 'Unbound.Generics.LocallyNameless.Operations.aeq' equal when they -- are the same name (in the sense of '(==)').  In patterns, however, -- any two names are equal if they occur in the same place within the
test/Calc.hs view
@@ -5,9 +5,12 @@ -- Maintainer : Aleksey Kliger -- Stability  : experimental ---{-# LANGUAGE DeriveGeneric, DeriveDataTypeable #-}+{-# LANGUAGE CPP, DeriveGeneric, DeriveDataTypeable #-} module Calc where +#if MIN_VERSION_base(4,9,0) && !MIN_VERSION_base(4,13,0)+import Control.Monad.Fail (MonadFail)+#endif import Control.Arrow (second) import Data.Typeable (Typeable) import GHC.Generics (Generic)@@ -67,7 +70,11 @@ extendEnv v e rho w =   if v == w then Just e else rho w -whnf :: (Fresh m) => Env -> Expr -> m Expr+whnf :: (+#if MIN_VERSION_base(4,9,0)+  MonadFail m,+#endif+  Fresh m) => Env -> Expr -> m Expr whnf rho (V v) = case rho v of   Just e -> return e   Nothing -> fail $ "unbound variable " ++ show v@@ -76,7 +83,11 @@   v1 <- whnf rho e1   v2 <- whnf rho e2   add v1 v2-  where add :: Monad m => Expr -> Expr -> m Expr+  where add :: (+#if MIN_VERSION_base(4,9,0)+          MonadFail m,+#endif+          Monad m) => Expr -> Expr -> m Expr         add (C i1) (C i2) = return (C $ i1 + i2)         add _ _ = fail "add of two non-integers" whnf rho0 (Let b) = do@@ -91,7 +102,11 @@   rho' <- whnfLsb lsb rho0   whnf rho' body -whnfLsb :: Fresh m => LetStarBinds -> Env -> m Env+whnfLsb :: (+#if MIN_VERSION_base(4,9,0)+  MonadFail m,+#endif+  Fresh m) => LetStarBinds -> Env -> m Env whnfLsb EmptyLSB = return whnfLsb (ConsLSB rbnd) = \rho -> do   let ((v, Embed e), lsb) = unrebind rbnd
unbound-generics.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                unbound-generics-version:             0.4.0+version:             0.4.1 synopsis:            Support for programming with names and binders using GHC Generics description:         Specify the binding structure of your data type with an                      expressive set of type combinators, and unbound-generics@@ -22,14 +22,14 @@ license-file:        LICENSE author:              Aleksey Kliger maintainer:          aleksey@lambdageek.org-copyright:           (c) 2014-2018, Aleksey Kliger+copyright:           (c) 2014-2020, Aleksey Kliger category:            Language build-type:          Simple extra-source-files:  examples/*.hs, examples/*.lhs,                      README.md,                      Changelog.md cabal-version:       >=1.10-tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.*, GHC == 8.2.*, GHC == 8.4.*, GHC == 8.6.*+tested-with: GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.3, GHC == 8.10.*               library   exposed-modules:     Unbound.Generics.LocallyNameless