I am fairly new to Haskell so it is probably something simple that I am missing but I have an expression tree that looks like this:
data Expression = Lit Float
| Add Expression Expression
| Mul Expression Expression
| Sub Expression Expression
| Div Expression Expression
And that code works perfectly fine but then when I try to add a deriving(Show, Read) so that Haskell automatically writes code to read and write elements of this type it throws an error.
This is what I am trying to do.
Lit Float deriving(Show, Read)
I get an error that reads error: parse error on input '|', and now the Add Expression Expression line doesn't work. Could someone point out to me what the error is here?