Skip to content

Instantly share code, notes, and snippets.

@sellout
Created May 1, 2014 16:30
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 sellout/ca17c6feca2c881a54d6 to your computer and use it in GitHub Desktop.
Save sellout/ca17c6feca2c881a54d6 to your computer and use it in GitHub Desktop.
data type : Type where
nat : type
bool : type
data tbinop : type -> type -> type -> Type where
TPlus : tbinop nat nat nat
TTimes : tbinop nat nat nat
TEq : (t : type) -> tbinop t t bool
TLt : tbinop nat nat bool
data texp : type -> Type where
TNConst : Nat -> texp nat
TBConst : Bool -> texp bool
TBinop : tbinop t1 t2 t -> texp t1 -> texp t2 -> texp t
typeDenote : type -> Type
typeDenote nat = Nat
typeDenote bool = Bool
tbinopDenote : tbinop arg1 arg2 res ->
typeDenote arg1 -> typeDenote arg2 -> typeDenote res
tbinopDenote TPlus = plus
tbinopDenote TTimes = mult
tbinopDenote (TEq nat) = (==)
tbinopDenote (TEq bool) = (==)
tbinopDenote TLt = (<)
-- line 24 col 14
-- Can't convert
-- tbinop nat nat bool
-- with
-- tbinop nat arg2 bool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment