mirror of
https://github.com/polysemy-research/polysemy.git
synced 2025-01-06 05:23:25 +03:00
fix test + reorder some params
This commit is contained in:
parent
9806fb7d07
commit
3f8489e28a
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user