So there was an example in Learn You A Haskell that I wanted to recast using list comprehension. Basically it should be a simple function f:[a]->[Char] as follows
let sayMe xs = [ if x <- [1..5] then show x else "Not a desired value" | x <- xs]
Unfortunately when I try to define the function I get the following error:
parse error in if statement: missing required then and else clauses
However, I do have the then and else clauses there and my function isn't, as far as I can tell, very far off from another example in the book which I have verified as working:
let sayMe xs = [if x<10 then "Bang!" else "Boom!"|x<-xs, odd x]
I know that there are other ways to do this, but I'd like to understand why this particular method isn't working the way I think it should.