Skip to content

Instantly share code, notes, and snippets.

@gallais
Forked from useronym/Instance.agda
Created July 28, 2017 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gallais/388c1f3c21b8910d0f4898c383dae55c to your computer and use it in GitHub Desktop.
Save gallais/388c1f3c21b8910d0f4898c383dae55c 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.print print-α begin = "."
Print.print print-α (step-α b) = "a" ++ print b
Print.print print-β (step-β a) = "b" ++ print a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment