Skip to content

Instantly share code, notes, and snippets.

@Legogris
Forked from jfdm/FoobarE.idr
Created October 12, 2015 20:40
Show Gist options
  • Select an option

  • Save Legogris/d25c5199bcf2c53c66dd to your computer and use it in GitHub Desktop.

Select an option

Save Legogris/d25c5199bcf2c53c66dd to your computer and use it in GitHub Desktop.
module FoobarE
import Effects
import Effect.State
import Effect.StdIO
MyProg : Type -> Type
MyProg rTy = Eff rTy ['mystate ::: STATE (List Nat), STDIO]
register : Nat -> MyProg ()
register x = 'mystate :- update (x::)
count : MyProg Nat
count = pure (length !('mystate :- get))
myProg : MyProg ()
myProg = do
register 1
register 2
printLn !count
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