Haskell let in/where and if indentation -


i have function:

issimplenumber :: int -> bool issimplenumber x = let derivelist = map (\y -> (x `mod` y)) [1 .. x]                        filterlength = length ( filter (\z -> z == 0) derivelist                        .... 

after filterlength want check how filterlength, try:

issimplenumber :: int -> bool issimplenumber x = let derivelist = map (\y -> (x `mod` y)) [1 .. x]                        filterlength = length ( filter (\z -> z == 0) derivelist                        in if filterlength == 2                           true 

i error:

    parse error (possibly incorrect indentation) failed, modules loaded: none. 

how can put indentation correctly if , in?

thank you.

this compile:

issimplenumber :: int -> bool issimplenumber x = let derivelist = map (\y -> (x `mod` y)) [1 .. x]                        filterlength = length ( filter (\z -> z == 0) derivelist )                    in filterlength == 2  main = print $ issimplenumber 5 

there missing closing ")" after "derivelist". don't need if-then-true expression, also.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -