[Haskell-cafe] Multiple statements with Where

insertjokehere aca05ll at shef.ac.uk
Tue Dec 18 09:00:23 EST 2007

Hi all, I am having problems adding multiple definitions with where for
example in my code

--A parser for recognising binary operations
parseBinaryOp :: String -> String -> [(Expr, Expr, String)]
parseBinaryOp op str
	| (elem op binops) && (notElem '(' (snd bm)) && (notElem ')' (snd bm)) &&
(elem nstr!!1 binops) = [(EInt 1, EInt 1, "HERE!")]
	| otherwise = []
		where bm = bracketMatch str
			  nstr = words (snd (bracketMatch str))

I get the error message
parse error on input `='

Essentially this function is supposed to parse binary operations in a
string, nstr is just a [String], binops is a list of Strings. The types
appear to be fine, and GHCI dosnt say that this is the problem, the problem
seems to lie with that definition of nstr after the definition of bm. I
believe I have followed the definitions correctly, so I am at a loss for how
to solve this problem. The list that is given for the first case is only a
placeholder, once I get past this problem I should be able to make the
function operate properly

Any help would be much appreciated, please tell me if you need more info.

Thankyou :-)
View this message in context: http://www.nabble.com/Multiple-statements-with-Where-tp14397482p14397482.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

More information about the Haskell-Cafe mailing list