"Tomasz Zielonka" <[EMAIL PROTECTED]> escreveu na mensagem
news:[EMAIL PROTECTED]
[snip]
> BTW, I already see some problems with this syntax. For example, this code
>
> case t of
> (x, y, (a, ctx @> Just z)) -> ctx z
>
> wouldn't be equivalent to this one
>
> case t of
> (x, y, v) ->
> case v of
> ctx @> (a, Just z) -> ctx z
I think it would work better if the context was always bound to the whole
pattern, using '_' patterns to define which parts of the pattern would be
copied and naming only the parts which are going to be changed:
case t of
ctx @> (_, _, v) ->
case v of
(a, Just z) -> ctx (a, z)
or
case t of
ctx @> (_, _, (_, Just z)) -> ctx z
This don't have the ambiguity and the need to keep track wether the context
is declared inside a pattern match or not. Also it could be used to more
complex changes:
case t of
ctx @> (x, _, _, _, _, c) -> ctx (x+1) (c+2)
> I would love to hear you opinions. Maybe you can think of some really
> convincing (or unconvincing) code examples?
>
> Best regards,
> Tomasz
Best regards,
Daniel Yokomizo.
"You may want Star Wars compilers, but I'm no Luke Skywalker."
- Cyril Adrian
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.832 / Virus Database: 566 - Release Date: 10/1/2005
_______________________________________________
Haskell mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell