packages feed

freer-simple 1.0.1.0 → 1.0.1.1

raw patch · 3 files changed

+30/−14 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Data.OpenUnion.Internal: instance (TypeError ...) => Data.OpenUnion.Internal.FindElem t '[] w
- Data.OpenUnion.Internal: instance Data.OpenUnion.Internal.FindElem t (t : r) w
- Data.OpenUnion.Internal: instance Data.OpenUnion.Internal.FindElem t r r => Data.OpenUnion.Internal.Member t r
- Data.OpenUnion.Internal: instance Data.OpenUnion.Internal.FindElem t r w => Data.OpenUnion.Internal.FindElem t (t' : r) w
+ Data.OpenUnion.Internal: class IfNotFound (t :: * -> *) (r :: [* -> *]) (w :: [* -> *])
+ Data.OpenUnion.Internal: instance (Data.OpenUnion.Internal.FindElem t r, Data.OpenUnion.Internal.IfNotFound t r r) => Data.OpenUnion.Internal.Member t r
+ Data.OpenUnion.Internal: instance (TypeError ...) => Data.OpenUnion.Internal.IfNotFound t '[] w
+ Data.OpenUnion.Internal: instance Data.OpenUnion.Internal.FindElem t (t : r)
+ Data.OpenUnion.Internal: instance Data.OpenUnion.Internal.FindElem t r => Data.OpenUnion.Internal.FindElem t (t' : r)
+ Data.OpenUnion.Internal: instance Data.OpenUnion.Internal.IfNotFound t (t : r) w
+ Data.OpenUnion.Internal: instance Data.OpenUnion.Internal.IfNotFound t r w
+ Data.OpenUnion.Internal: instance Data.OpenUnion.Internal.IfNotFound t r w => Data.OpenUnion.Internal.IfNotFound t (t' : r) w
- Control.Monad.Freer: class FindElem eff effs effs => Member (eff :: * -> *) effs
+ Control.Monad.Freer: class FindElem eff effs => Member (eff :: * -> *) effs
- Data.OpenUnion: class FindElem eff effs effs => Member (eff :: * -> *) effs
+ Data.OpenUnion: class FindElem eff effs => Member (eff :: * -> *) effs
- Data.OpenUnion.Internal: P :: Word -> P t r w
+ Data.OpenUnion.Internal: P :: Word -> P t r
- Data.OpenUnion.Internal: [unP] :: P t r w -> Word
+ Data.OpenUnion.Internal: [unP] :: P t r -> Word
- Data.OpenUnion.Internal: class FindElem (t :: * -> *) (r :: [* -> *]) (w :: [* -> *])
+ Data.OpenUnion.Internal: class FindElem (t :: * -> *) (r :: [* -> *])
- Data.OpenUnion.Internal: class FindElem eff effs effs => Member (eff :: * -> *) effs
+ Data.OpenUnion.Internal: class FindElem eff effs => Member (eff :: * -> *) effs
- Data.OpenUnion.Internal: elemNo :: FindElem t r w => P t r w
+ Data.OpenUnion.Internal: elemNo :: FindElem t r => P t r
- Data.OpenUnion.Internal: newtype P t r w
+ Data.OpenUnion.Internal: newtype P t r

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+# 1.0.1.1++- Fixed a bug that could cause `Member` constraints to erroneously fail to solve ([#3](https://github.com/lexi-lambda/freer-simple/pull/3)).+ # 1.0.1.0  - Added `subsume` to `Control.Monad.Freer` for deduplicating effects.
freer-simple.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 1b33b14be04bebcd0fa94c86502cf8b40f41ecf708b33c723951b76d9ef4f017+-- hash: 510c61e88946fcfca5f48fe0358a0c8e9c9b3c89db3f9934a231ffd539702e49  name:           freer-simple-version:        1.0.1.0+version:        1.0.1.1 synopsis:       Implementation of a friendly effect system for Haskell. description:    An implementation of an effect system for Haskell (a fork of                 <http://hackage.haskell.org/package/freer-effects freer-effects>), which is
src/Data/OpenUnion/Internal.hs view
@@ -69,31 +69,35 @@  -- | Represents position of element @t :: * -> *@ in a type list -- @r :: [* -> *]@.-newtype P t r w = P {unP :: Word}+newtype P t r = P {unP :: Word}  -- | Find an index of an element @t :: * -> *@ in a type list @r :: [* -> *]@. -- The element must exist. The @w :: [* -> *]@ type represents the entire list, -- prior to recursion, and it is used to produce better type errors. -- -- This is essentially a compile-time computation without run-time overhead.-class FindElem (t :: * -> *) (r :: [* -> *]) (w :: [* -> *]) where+class FindElem (t :: * -> *) (r :: [* -> *]) where   -- | Position of the element @t :: * -> *@ in a type list @r :: [* -> *]@.   --   -- Position is computed during compilation, i.e. there is no run-time   -- overhead.   --   -- /O(1)/-  elemNo :: P t r w+  elemNo :: P t r  -- | Base case; element is at the current position in the list.-instance FindElem t (t ': r) w where+instance FindElem t (t ': r) where   elemNo = P 0  -- | Recursion; element is not at the current position, but is somewhere in the -- list.-instance {-# OVERLAPPABLE #-} FindElem t r w => FindElem t (t' ': r) w where-  elemNo = P $ 1 + unP (elemNo :: P t r w)+instance {-# OVERLAPPABLE #-} FindElem t r => FindElem t (t' ': r) where+  elemNo = P $ 1 + unP (elemNo :: P t r) +-- | Instance resolution for this class fails with a custom type error+-- if @t :: * -> *@ is not in the list @r :: [* -> *]@.+class IfNotFound (t :: * -> *) (r :: [* -> *]) (w :: [* -> *])+ -- | If we reach an empty list, that’s a failure, since it means the type isn’t -- in the list. For GHC >=8, we can render a custom type error that explicitly -- states what went wrong.@@ -102,9 +106,17 @@                     ':$$: 'Text "  ‘" ':<>: 'ShowType w ':<>: 'Text "’"                     ':$$: 'Text "In the constraint ("                     ':<>: 'ShowType (Member t w) ':<>: 'Text ")")-    => FindElem t '[] w where-  elemNo = error "impossible"+    => IfNotFound t '[] w +instance IfNotFound t (t ': r) w+instance {-# OVERLAPPABLE #-} IfNotFound t r w => IfNotFound t (t' ': r) w++-- | Pass if @r@ is uninstantiated. The incoherence here is safe, since picking+-- this instance doesn’t cause any variation in behavior, except possibly the+-- production of an inferior error message. For more information, see+-- lexi-lambda/freer-simple#3, which describes the motivation in more detail.+instance {-# INCOHERENT #-} IfNotFound t r w+ -- | A constraint that requires that a particular effect, @eff@, is a member of -- the type-level list @effs@. This is used to parameterize an -- 'Control.Monad.Freer.Eff' computation over an arbitrary list of effects, so@@ -116,7 +128,7 @@ -- @ -- 'Member' ('Control.Monad.Freer.State.State' 'Integer') effs => 'Control.Monad.Freer.Eff' effs () -- @-class FindElem eff effs effs => Member (eff :: * -> *) effs where+class FindElem eff effs => Member (eff :: * -> *) effs where   -- This type class is used for two following purposes:   --   -- * As a @Constraint@ it guarantees that @t :: * -> *@ is a member of a@@ -144,11 +156,11 @@   -- /O(1)/   prj :: Union effs a -> Maybe (eff a) -instance FindElem t r r => Member t r where-  inj = unsafeInj $ unP (elemNo :: P t r r)+instance (FindElem t r, IfNotFound t r r) => Member t r where+  inj = unsafeInj $ unP (elemNo :: P t r)   {-# INLINE inj #-} -  prj = unsafePrj $ unP (elemNo :: P t r r)+  prj = unsafePrj $ unP (elemNo :: P t r)   {-# INLINE prj #-}  -- | Orthogonal decomposition of a @'Union' (t ': r) :: * -> *@. 'Right' value