Last active
October 13, 2015 13:34
-
-
Save jfdm/3e20fca2382bbe0675d3 to your computer and use it in GitHub Desktop.
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
module FoobarE | |
import Effects | |
import Effect.State | |
import Effect.StdIO | |
namespace Lib | |
MyLib : Type -> Type | |
MyLib rTy = Eff rTy ['libstate ::: STATE (List Nat), STDIO] | |
register : Nat -> MyLib () | |
register x = 'libstate :- update (x::) | |
count : MyLib Nat | |
count = pure (length !('libstate :- get)) | |
namespace User | |
User : Type -> Type | |
User rTy = Eff rTy [ 'libstate ::: STATE (List Nat) | |
, 'mystate ::: STATE (List Nat) | |
, STDIO] | |
wipe : User () | |
wipe = 'libstate :- put Nil | |
myProg : User () | |
myProg = do | |
register 1 | |
register 2 | |
printLn !count | |
wipe | |
register 3 | |
register 4 | |
printLn !count | |
namespace Main | |
main : IO () | |
main = run myProg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment