-
-
Save Legogris/d25c5199bcf2c53c66dd to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| 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