polysemy/test/Spec.hs

27 lines
454 B
Haskell
Raw Normal View History

2019-03-17 21:09:09 +03:00
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TemplateHaskell #-}
import Test.Inspection
import Control.Monad.Discount
import Data.OpenUnion
import TRYAGAIN hiding (main)
2019-02-13 23:52:56 +03:00
main :: IO ()
2019-03-17 21:09:09 +03:00
main = pure ()
go :: Eff '[State Int] Int
go = do
n <- send (Get id)
if n <= 0
then pure n
else do
send $ Put (n-1) ()
go
countDown :: Int -> Int
countDown start = fst $ run $ runState start go
inspect $ 'countDown `hasNoType` ''SNat