On Sat, May 21, 2011 at 10:49, Paolo Giarrusso <[email protected]>wrote:

> On Sat, May 21, 2011 at 16:27, Brandon Allbery <[email protected]>
> wrote:
> > On Sat, May 21, 2011 at 10:17, Paolo G. Giarrusso <[email protected]
> >
> > wrote:
> >>
> >> First, thanks to you and everybody for the alternative. But I'm still
> >> convinced that the syntax is supposed to work, and you're just
> >> workarounding the bug.
> >
> > Hm, I think we have differing expectations; the syntax everyone presented
> is
> > the one that is normally used for such things in ghci, and while perhaps
> the
> > one you tried is supposed to work, it's a bit unusual and therefore
> probably
> > not very well tested.
>
> Yes, it was my guess as well - and for some reason I missed the usual
> syntax.
> A sincere question about the usual syntax: where do you learn it? It's
>

It's just the desugaring of layout, with the braces being optional because
it's all on one line.  Since you can't use layout in ghci, you have to
manually convert.  It is perhaps not entirely obvious (I was a bit surprised
when, as a complete Haskell newbie, I decided to try it and it worked) that
you can specify types in both let and where clauses in the same way you do
at the top level:

> let a :: a -> a
>     a = a a
>   where b :: b -> b
>         b = b b

which in its non-layout version is

> let { a :: a -> a; a = a a } where { b :: b -> b; b = b b }

(using the braces here because it's a bit ambiguous; I think H'2010 fixed
that though)
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to