mirror of
https://github.com/polysemy-research/polysemy.git
synced 2024-11-30 07:13:55 +03:00
478c86e080
* 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
23 lines
521 B
Haskell
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
|