extensible-effects 2.0.0.0 → 2.0.0.2
raw patch · 19 files changed
+18/−28 lines, 19 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Control.Eff.Operational.Example: adventIO :: (Member (Lift IO) r, SetMember Lift (Lift IO) r) => Jail a -> Eff r a
+ Control.Eff.Operational.Example: adventIO :: (SetMember Lift (Lift IO) r) => Jail a -> Eff r a
Files
- extensible-effects.cabal +1/−1
- src/Control/Eff.hs +2/−1
- src/Control/Eff/Choose.hs +1/−2
- src/Control/Eff/Coroutine.hs +0/−1
- src/Control/Eff/Example.hs +1/−0
- src/Control/Eff/Exception.hs +1/−1
- src/Control/Eff/Fresh.hs +0/−2
- src/Control/Eff/Lift.hs +0/−4
- src/Control/Eff/NdetEff.hs +1/−0
- src/Control/Eff/Operational.hs +2/−6
- src/Control/Eff/Operational/Example.hs +2/−9
- src/Control/Eff/Reader/Lazy.hs +1/−0
- src/Control/Eff/Reader/Strict.hs +1/−0
- src/Control/Eff/State/Lazy.hs +1/−0
- src/Control/Eff/State/LazyState.hs +1/−0
- src/Control/Eff/State/Strict.hs +1/−0
- src/Control/Eff/Trace.hs +0/−1
- src/Control/Eff/Writer/Lazy.hs +1/−0
- src/Control/Eff/Writer/Strict.hs +1/−0
extensible-effects.cabal view
@@ -6,7 +6,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 2.0.0.0+version: 2.0.0.2 -- A short (one-line) description of the package. synopsis: An Alternative to Monad Transformers
src/Control/Eff.hs view
@@ -107,6 +107,7 @@ fmap f (E u q) = E u (q |> (Val . f)) -- does no mapping yet! instance Applicative (Eff r) where+ {-# INLINE pure #-} pure = Val Val f <*> Val x = Val $ f x Val f <*> E u q = E u (q |> (Val . f))@@ -116,7 +117,7 @@ instance Monad (Eff r) where {-# INLINE return #-} {-# INLINE [2] (>>=) #-}- return x = Val x+ return = pure Val x >>= k = k x E u q >>= k = E u (q |> k) -- just accumulates continuations {-
src/Control/Eff/Choose.hs view
@@ -1,10 +1,9 @@---{-# OPTIONS_GHC -Werror #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeOperators #-}-+{-# LANGUAGE Safe #-} -- The following is needed to define MonadPlus instance. It is decidable -- (there is no recursion!), but GHC cannot see that. {-# LANGUAGE UndecidableInstances #-}
src/Control/Eff/Coroutine.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE TypeOperators #-}-{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE DataKinds #-}
src/Control/Eff/Example.hs view
@@ -1,6 +1,7 @@ {-# OPTIONS_GHC -Werror #-} {-# LANGUAGE TypeOperators, GADTs, DataKinds #-} {-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE Safe #-} -- | Example usage of "Control.Eff1" module Control.Eff.Example where
src/Control/Eff/Exception.hs view
@@ -1,9 +1,9 @@---{-# OPTIONS_GHC -Werror #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeOperators #-}+{-# LANGUAGE Safe #-} -- | Exception-producing and exception-handling effects module Control.Eff.Exception ( Exc (..) , Fail
src/Control/Eff/Fresh.hs view
@@ -1,7 +1,5 @@---{-# OPTIONS_GHC -Werror #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE DeriveFunctor #-}-{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-}
src/Control/Eff/Lift.hs view
@@ -1,11 +1,7 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE CPP #-}-#if __GLASGOW_HASKELL__ < 708-{-# LANGUAGE Trustworthy #-}-#else {-# LANGUAGE Safe #-}-#endif -- | Lifting primitive Monad types to effectful computations. -- We only allow a single Lifted Monad because Monads aren't commutative -- (e.g. Maybe (IO a) is functionally distinct from IO (Maybe a)).
src/Control/Eff/NdetEff.hs view
@@ -5,6 +5,7 @@ {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeOperators #-}+{-# LANGUAGE Safe #-} -- The following is needed to define MonadPlus instance. It is decidable -- (there is no recursion!), but GHC cannot see that. {-# LANGUAGE UndecidableInstances #-}
src/Control/Eff/Operational.hs view
@@ -6,12 +6,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE CPP #-}-{-# LANGUAGE DeriveDataTypeable #-}-#if __GLASGOW_HASKELL__ < 708-{-# LANGUAGE Trustworthy #-}-#else {-# LANGUAGE Safe #-}-#endif -- | Operational Monad (<https://wiki.haskell.org/Operational>) implemented with -- extensible effects.@@ -50,6 +45,7 @@ -- @ --main :: IO () --main = do--- putStrLn . fst . 'run' . 'runMonoidWriter' . 'evalState' [\"foo\",\"bar\"] $ 'runProgram' adventPure prog+-- let comp = 'runProgram' adventPure prog+-- putStrLn . fst . 'run' . 'runMonoidWriter' $ 'evalState' comp [\"foo\",\"bar\"] -- 'runLift' $ 'runProgram' adventIO prog -- @
src/Control/Eff/Operational/Example.hs view
@@ -1,8 +1,7 @@-{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE CPP #-}--- {-# LANGUAGE Safe #-}+{-# LANGUAGE Safe #-} -- | Example usage of "Control.Eff.Operational". module Control.Eff.Operational.Example where@@ -13,17 +12,11 @@ import Control.Eff.Lift import Control.Eff.Writer.Lazy import Control.Eff.State.Lazy-import Data.Typeable -#if __GLASGOW_HASKELL__ >= 708-#define Typeable1 Typeable-#endif- -- | Define data using GADTs. data Jail a where Print :: String -> Jail () Scan :: Jail String- deriving (Typeable) prog :: Member (Program Jail) r => Eff r () prog = do@@ -33,7 +26,7 @@ singleton $ Print ("the input is " ++ str) -- | Then, implements interpreters from the data to effects.-adventIO :: (Member (Lift IO) r, SetMember Lift (Lift IO) r) => Jail a -> Eff r a+adventIO :: (SetMember Lift (Lift IO) r) => Jail a -> Eff r a adventIO (Print a) = lift $ putStrLn a adventIO Scan = lift getLine
src/Control/Eff/Reader/Lazy.hs view
@@ -3,6 +3,7 @@ {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeOperators #-}+{-# LANGUAGE Safe #-} -- | Lazy read-only state module Control.Eff.Reader.Lazy ( Reader (..) , ask
src/Control/Eff/Reader/Strict.hs view
@@ -4,6 +4,7 @@ {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeOperators #-}+{-# LANGUAGE Safe #-} -- | Strict read-only state module Control.Eff.Reader.Strict ( Reader (..) , ask
src/Control/Eff/State/Lazy.hs view
@@ -6,6 +6,7 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeOperators #-}+{-# LANGUAGE Trustworthy #-} -- | Lazy state effect module Control.Eff.State.Lazy where
src/Control/Eff/State/LazyState.hs view
@@ -4,6 +4,7 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE NoMonomorphismRestriction #-}+{-# LANGUAGE Safe #-} -- | On-demand state computation: -- example taken from Edward Kmett's comment here:
src/Control/Eff/State/Strict.hs view
@@ -7,6 +7,7 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeOperators #-}+{-# LANGUAGE Trustworthy #-} -- | Strict state effect module Control.Eff.State.Strict where
src/Control/Eff/Trace.hs view
@@ -1,6 +1,5 @@ {-# OPTIONS_GHC -Werror #-} {-# LANGUAGE TypeOperators #-}-{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs, DataKinds #-}
src/Control/Eff/Writer/Lazy.hs view
@@ -3,6 +3,7 @@ {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeOperators #-}+{-# LANGUAGE Safe #-} -- | Lazy write-only state module Control.Eff.Writer.Lazy ( Writer(..) , tell
src/Control/Eff/Writer/Strict.hs view
@@ -4,6 +4,7 @@ {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeOperators #-}+{-# LANGUAGE Safe #-} -- | Strict write-only state module Control.Eff.Writer.Strict ( Writer(..) , tell