Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: Functions in "where" block. (Jacek Dudek)
----------------------------------------------------------------------
Message: 1
Date: Tue, 24 Jun 2014 12:44:34 -0400
From: Jacek Dudek <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Functions in "where" block.
Message-ID:
<CAJxg2_Fz4QQyuuxNVcEEGoaGBN26a4zKybJWUL5sD8qsRKjr=q...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
{- Hi Venu,
the problem is incorrect indentation. The line that defines ep must
have the same (or greater) indentation than the line that defines op.
Also, it is recommended that you use strictly spaces for indentation.
In some editors, for example Vim, you can set an option that
automatically converts your tab keystrokes into spaces.
Copy this email as is with the code below to see one possible
convention for writing where clauses. To recreate the same error
again, move the line that defines ep back one space.
By the way, your email landed in my spam box for some reason, so you
might not be getting any replies to subsequent emails.
-}
myFun :: Integer -> Integer
myFun x = op x + ep x
where
op x = 99
ep x = 1
On 6/11/14, Venu Chakravorty <[email protected]> wrote:
> 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.
>
>
>
> Regards,
> Venu Chakravorty.
>
>
>
>
>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 72, Issue 17
*****************************************