polysemy/test/TacticsSpec.hs
KingoftheHomeless 478c86e080
Simple variants of runT and bindT (#393)
* Simple variants of runT and bindT

* Fix accidental removal of INLINE on reinterpretH

* Rename bindTH and runTH to -Simple instead. Improve docs on these.

* Update changelog and add @since TODOs
2020-11-18 20:46:14 +01:00

23 lines
521 B
Haskell

module TacticsSpec where
import Polysemy
import Polysemy.Internal (send)
import Test.Hspec
data TestE :: Effect where
TestE :: m a -> (a -> m b) -> TestE m b
interpretTestE :: InterpreterFor TestE r
interpretTestE =
interpretH $ \case
TestE ma f -> do
a <- runTSimple ma
bindTSimple f a
spec :: Spec
spec = parallel $ describe "runTH and bindTH" $ do
it "should act as expected" $ do
r <- runM (interpretTestE (send (TestE (pure 5) (pure . (9 +)))))
print r
(14 :: Int) `shouldBe` r