Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
data Pair a = Pair a a
data Exp typ where
Vec :: Exp a -> Exp a -> Exp (Pair a)
Const :: Int -> Exp Int
-- with type
type RHS typ = String
data Statement typ =
RHS typ := Exp typ
vec :: RHS (Pair Int)
vec = "test"
x = vec := Const 3
-- with data
data RHS' typ = RHS String
data Statement' typ =
RHS' typ ::= Exp typ
vec' :: RHS' (Pair Int)
vec' = RHS "test"
-- will produce expected compile error:
-- Couldn't match type `Int' with `Pair Int'
-- x' = vec' ::= Const 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.