[Haskell-beginners] A newbie question

Mianlai Zhou mianlai at gmail.com
Wed Dec 8 18:18:26 CET 2010


Brandon,

Thanks a lot for your explanation!
M. Zhou
On Thu, Dec 9, 2010 at 12:48 AM, Brandon S Allbery KF8NH <
allbery at ece.cmu.edu> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 12/8/10 11:18 , Mianlai Zhou wrote:
> > 1. What does "where" in line 2 mean? Why I should put it here in this
> place?
> > If there is no "where"
> > here, the program cannot run. But what is the syntactical meaning of
> "where"?
>
> It's just Haskell's syntax convention.  Most Haskell declarations have the
> format "<whatever> <name> where ..." (module, class, instance; data if
> GADTs
> are enabled; functions also can have "where" clauses introducing local
> definitions).
>
> > 2. Why this module can end without an "end" sentence? And what are the
> blank
> > lines treated as?
>
> Haskell doesn't use keywords for delimiters; it mostly uses layout (like
> Python but IMO a bit saner) although you can use explicit braces and
> semicolons if you really want to.  The module declaration is somewhat
> special in that you don't have to indent the declarations in its "where"
> clause; but the price of this is you can only have one module per file.
> (Otherwise you'd have to either use braces or obey the layout rule and
> indent everything.)
>
> The blank lines do nothing special.
>
> - --
> brandon s. allbery     [linux,solaris,freebsd,perl]      allbery at kf8nh.com
> system administrator  [openafs,heimdal,too many hats]  allbery at ece.cmu.edu
> electrical and computer engineering, carnegie mellon university      KF8NH
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.10 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkz/tvkACgkQIn7hlCsL25VO2wCg1/MFpxwIAjhDlmvCVxqAmjMm
> VJwAmgOrmX06F6EbQNKE9kORr+SlrLL/
> =ktj3
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20101209/8f89488d/attachment.htm>


More information about the Beginners mailing list