Skip to content

Instantly share code, notes, and snippets.

@useronym
Created July 28, 2017 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save useronym/4221766151007abb58998cfb951737c7 to your computer and use it in GitHub Desktop.
Save useronym/4221766151007abb58998cfb951737c7 to your computer and use it in GitHub Desktop.
open import Data.String
record Print (A : Set) : Set where
field
print : A → String
open Print {{…}} public
mutual
data α : Set where
begin : α
step-α : β → α
data β : Set where
step-β : α → β
example : α
example = step-α (step-β begin)
mutual
instance
print-α : Print α
print-β : Print β
print-α = record { print = λ {begin → "."
; (step-α b) → "a" ++ (print b)} }
print-β = record { print = λ {(step-β a) → "b" ++ (print a)} }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment