view paper/src/CodeSegment.agda @ 58:68bf744d726e

Writing cs/ds in agda
author atton <atton@cr.ie.u-ryukyu.ac.jp>
date Wed, 01 Feb 2017 14:52:01 +0900
parents
children 5450e7ae5fa5
line wrap: on
line source

data CodeSegment {l1 l2 : Level} (I : Set l1) (O : Set l2) : Set (l ⊔ l1 ⊔ l2) where
  cs : (I -> O) -> CodeSegment I O

cs2 : CodeSegment ds1 ds1
cs2 = cs id

cs1 : CodeSegment ds1 ds1
cs1 = cs (\d -> goto cs2 d)

cs0 : CodeSegment ds0 ds1
cs0 = cs (\d -> goto cs1 (record {c = (ds0.a d) + (ds0.b d)}))

main : ds1
main = goto cs0 (record {a = 100 ; b = 50})