[Haskell-beginners] Functions in "where" block.

Venu Chakravorty c.venu at aol.com
Thu Jun 12 01:54:42 UTC 2014

Hello everyone,
	I can't figure out why the following function does not work:

myFun :: Integer -> Integer
myFun x = op x + ep x
          where op x = 99
		    ep x = 1      -- squawks here

	Yeah it's a stupid function, but I was just trying to declare two functions in the "where" block. I expected
this to work and always return 100.

This is the error I get while compiling:

Prelude> :l fun.hs
[1 of 1] Compiling Main             ( fun.hs, interpreted )

fun.hs:4:15: parse error on input `='
Failed, modules loaded: none.


Could someone please tell me where I am going wrong?
Thanks in advance.

Venu Chakravorty.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140611/77384d2c/attachment.html>

More information about the Beginners mailing list