Skip to content

Instantly share code, notes, and snippets.

@hasufell hasufell/Main.hs
Created Jun 30, 2016

Embed
What would you like to do?
freer tests
{-# LANGUAGE GADTs #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DataKinds #-}
module Main where
import Control.Monad.Freer
import Control.Monad.Freer.Reader
import Control.Monad.Freer.State
main :: IO ()
main = do
print $ run $ flip runReader "go" $ runState (foo "blah") 4
foo :: String -> Eff '[State Int, Reader String] Bool
foo str = do
v <- get
s <- ask
if s == "go"
then put (2 :: Int)
else return ()
if v > (3 :: Int)
then return True
else return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.