-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
175ccc8
commit 478c86e
Showing
6 changed files
with
100 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
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 |