mirror of
https://github.com/polysemy-research/polysemy.git
synced 2024-12-03 21:13:10 +03:00
Merge branch 'master' into plugin
This commit is contained in:
commit
86e2490a1a
15
ChangeLog.md
15
ChangeLog.md
@ -1,8 +1,17 @@
|
||||
# Changelog for polysemy
|
||||
|
||||
## 0.1.2.0 (2019-04-26)
|
||||
|
||||
- `runInputAsReader`, `runTraceAsOutput` and `runOutputAsWriter` have more
|
||||
generalized types
|
||||
- Added `runStateInIO`
|
||||
- Added `runOutputAsTrace`
|
||||
- Added `Members` (thanks to @TheMatten)
|
||||
|
||||
|
||||
## 0.1.1.0 (2019-04-14)
|
||||
|
||||
- Added 'runIO' interpretation (thanks to @adamConnerSax)
|
||||
- Added `runIO` interpretation (thanks to @adamConnerSax)
|
||||
- Minor documentation fixes
|
||||
|
||||
|
||||
@ -12,7 +21,3 @@
|
||||
|
||||
## Unreleased changes
|
||||
|
||||
- `runInputAsReader`, `runTraceAsOutput` and `runOutputAsWriter` have more
|
||||
generalized types
|
||||
- Added `runStateInIO`
|
||||
- Added `runOutputAsTrace`
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: polysemy
|
||||
version: 0.1.1.0
|
||||
version: 0.1.2.0
|
||||
github: "isovector/polysemy"
|
||||
license: BSD3
|
||||
author: "Sandy Maguire"
|
||||
|
@ -4,10 +4,10 @@ cabal-version: 1.12
|
||||
--
|
||||
-- see: https://github.com/sol/hpack
|
||||
--
|
||||
-- hash: a746514de75e4e865e1cecad7b39efb038ae28b0024a9285dcd3ed80606f822f
|
||||
-- hash: e7d506fb8346095c09f6efd4fec48a435a2e85513956419a807073dea1fe0274
|
||||
|
||||
name: polysemy
|
||||
version: 0.1.1.0
|
||||
version: 0.1.2.0
|
||||
synopsis: Higher-order, low-boilerplate, zero-cost free monads.
|
||||
description: Please see the README on GitHub at <https://github.com/isovector/polysemy#readme>
|
||||
category: Language
|
||||
|
@ -2,6 +2,7 @@ module Polysemy
|
||||
( -- * Core Types
|
||||
Sem ()
|
||||
, Member
|
||||
, Members
|
||||
|
||||
-- * Running Sem
|
||||
, run
|
||||
@ -110,9 +111,6 @@ module Polysemy
|
||||
, runT
|
||||
, bindT
|
||||
|
||||
-- * Reexports
|
||||
, Typeable
|
||||
|
||||
-- * Deprecated Names
|
||||
-- | The following exports are deprecated, and are exposed only for
|
||||
-- backwards compatability reasons. They will be removed in the next major
|
||||
@ -123,7 +121,6 @@ module Polysemy
|
||||
, makeSemantic_
|
||||
) where
|
||||
|
||||
import Data.Typeable
|
||||
import Polysemy.Internal
|
||||
import Polysemy.Internal.Combinators
|
||||
import Polysemy.Internal.TH.Effect
|
||||
|
@ -6,6 +6,7 @@
|
||||
module Polysemy.Internal
|
||||
( Sem (..)
|
||||
, Member
|
||||
, Members
|
||||
, send
|
||||
, sendM
|
||||
, run
|
||||
@ -23,6 +24,7 @@ import Control.Applicative
|
||||
import Control.Monad.Fix
|
||||
import Control.Monad.IO.Class
|
||||
import Data.Functor.Identity
|
||||
import Data.Kind
|
||||
import Polysemy.Internal.Effect
|
||||
import Polysemy.Internal.Fixpoint
|
||||
import Polysemy.Internal.Lift
|
||||
@ -129,6 +131,34 @@ newtype Sem r a = Sem
|
||||
}
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
-- | Makes constraints of functions that use multiple effects shorter by
|
||||
-- translating single list of effects into multiple 'Member' constraints:
|
||||
--
|
||||
-- @
|
||||
-- foo :: 'Members' \'[ 'Polysemy.Output.Output' Int
|
||||
-- , 'Polysemy.Output.Output' Bool
|
||||
-- , 'Polysemy.State' String
|
||||
-- ] r
|
||||
-- => 'Sem' r ()
|
||||
-- @
|
||||
--
|
||||
-- translates into:
|
||||
--
|
||||
-- @
|
||||
-- foo :: ( 'Member' ('Polysemy.Output.Output' Int) r
|
||||
-- , 'Member' ('Polysemy.Output.Output' Bool) r
|
||||
-- , 'Member' ('Polysemy.State' String) r
|
||||
-- )
|
||||
-- => 'Sem' r ()
|
||||
-- @
|
||||
--
|
||||
-- @since 0.1.2.0
|
||||
type family Members es r :: Constraint where
|
||||
Members '[] r = ()
|
||||
Members (e ': es) r = (Member e r, Members es r)
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
-- | Like 'runSem' but flipped for better ergonomics sometimes.
|
||||
usingSem
|
||||
|
Loading…
Reference in New Issue
Block a user