fix test + reorder some params

This commit is contained in:
Sandy Maguire 2019-04-10 14:57:29 -04:00
parent 9806fb7d07
commit 3f8489e28a
3 changed files with 10 additions and 9 deletions

View File

@ -20,7 +20,7 @@ import Polysemy.Internal.Union
data Error e m a where
Throw :: e -> Error e m a
Catch :: m a -> (e -> m a) -> Error e m a
Catch :: e m a. m a -> (e -> m a) -> Error e m a
makeSemantic ''Error

View File

@ -9,8 +9,8 @@ import Polysemy.Output
import Polysemy.State
data Writer o m a where
Tell :: o -> Writer o m ()
Listen :: m a -> Writer o m (o, a)
Tell :: o -> Writer o m ()
Listen :: o m a. m a -> Writer o m (o, a)
Censor :: (o -> o) -> m a -> Writer o m a
makeSemantic ''Writer

View File

@ -8,11 +8,12 @@ module FusionSpec where
import qualified Control.Monad.Trans.Except as E
import qualified Control.Monad.Trans.State.Strict as S
import Polysemy
import Polysemy.Error
import Polysemy.Interpretation
import Polysemy.Internal
import Polysemy.Internal.Combinators
import Polysemy.Internal.Effect
import Polysemy.Internal.Union
import Polysemy.State
import Polysemy.Union
import Test.Hspec
import Test.Inspection
@ -50,11 +51,11 @@ spec = do
go :: Semantic '[State Int] Int
go = do
n <- send (Get id)
n <- get
if n <= 0
then pure n
else do
send $ Put (n-1) ()
put (n-1)
go
@ -71,5 +72,5 @@ countDown start = fst $ run $ runState start go
jank :: Int -> Int
jank start = fst $ run $ runState start $ reinterpret send $ go
jank start = fst $ run $ runState start $ go