Call to arms: lambda-case is stuck and needs your help
Simon Marlow
marlowsd at gmail.com
Fri Jul 6 11:25:15 CEST 2012
On 05/07/2012 20:31, Tyson Whitehead wrote:
> On July 5, 2012 10:42:53 Mikhail Vorozhtsov wrote:
>> After 21 months of occasional arguing the lambda-case proposal(s) is in
>> danger of being buried under its own trac ticket comments. We need fresh
>> blood to finally reach an agreement on the syntax. Read the wiki
>> page[1], take a look at the ticket[2], vote and comment on the proposals!
>
> If I understand correctly, we currently we have
>
> \ apat1 ... apatn -> exp
>
> The possibility using '\' as a layout herald (like let, do, etc.)
>
> \ { apat1 ... apatn -> exp; ... }
>
> is suggested on the wiki, but rejected because code like so
>
> mask $ \restore -> do
> stmt1
> ...
>
> by translating it into (Section 9.3 of the 98 Report)
>
> mask $ \ { restore -> do { }
> } stmt1
>
> http://www.haskell.org/onlinereport/syntax-iso.html
>
> The reason for this is
>
> 1 - the layout level for '\' is the column of the 'restore' token
>
> 2 - the layout level for 'do' would be the column of the first token of 'stmt1'
>
> 3 - the '\' level is greater than the potential 'do' level so the fall through
> '{}' insertion rule fires instead of the desired '{' insertion rule
>
> 4 - the '\' level is greater than the identation level for the first token of
> 'stms1' (now established to not be part of the 'do') so the '}' rule fires
>
> Why not just let enclosed scopes be less indented than their outer ones?
I think this is undesirable. You get strange effects like
f x y = x + y
where -- I just left this where here by accident
g x = ...
parses as
f x y = x + y
where { -- I just left this empty where here by accident
g x = ...
}
and
instance Exception Foo where
instance Exception Bar
parses as
instance Exception Foo where {
instance Exception Bar
}
That is, layout contexts that should really be empty end up surprisingly
swallowing the rest of the file.
Cheers,
Simon
> It would then correctly translate the above. This of course implies that any
> code that requires the original translation (i.e., where the last of multiple
> enclosing blocks should be an empty block) would no longer work.
>
> Is any code actually relying on this though? It seems like a pretty esoteric
> corner case. If not, my vote would be to relax this rule and go with '\'
> being a layout hearld with full case style matching (i.e., guards too).
>
> Cheers! -Tyson
>
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>
More information about the Glasgow-haskell-users
mailing list