Haskell Syntax: Parse Error On Input
- by NuNu
As part of a mini-haskell compiler that I'm writing, I have a function named app. What I want this function to do is take in these arguments epp (App e1 e2). The first step would be to evaluate e1 recursively (epp e1) and check if the output would be an error. If not then evaluate e2 and then call another function eppVals to evaluate the outputs of the calls on e1 and e2 which I defined as v1 and v2 respectively.
epp (App e1 e2)
| epp e1 /= Error = eppVals v1 v2
| otherwise = Error
where v1 = epp e1
v2 = epp e2 <- parse error on input `='
Logically I believe what I have written so far works but I'm getting a parse error on input = where I stated above. Any idea why?
My second try
epp :: Exp -> Error Val
epp (App e1 e2) = (eppVals v1 v2) where
v1 = (epp e1)
v2 = (epp e2)
But now throws Couldn't match expected type Val with actual type Error Val