I have the following
data Expr = Condition v
| And Expr Expr
| Or Expr Expr
and I am asked to consider the follow untyped version in order to complete:
data Expr e where
I'm not sure what I'm suppose to write for the constructors. I tried the following:
data Expr e where
Condition :: v -> Expr v
And :: -- really not sure what to do with this one
OR :: Expr b -> (Expr b -> Expr a) -> Maybe Expr a -> Expr b
Also, since v
can be of any type ie int
, bool
etc is it possible just to call it the following (above) and declare the type of v
later?
data v = IntVat int
any help would be much appreciated :)
EDIT : changed the whole post to add a little bit more information and clarity (based on my understanding of the exercise).
Basically I need help figuring out the constructors for the GADTs given the data Expr = Condition v...etc
as reference.
Expr
has no parameter (in contrast to the GADT one), is that on purpose? – huonV
is not a type variable (in the first definition), since it's uppercase it must refer to a specific type, right? – Peter