[Haskell-cafe] How come pattern match does not recognize this code style?

Magicloud Magiclouds magicloud.magiclouds at gmail.com
Mon Oct 26 01:08:25 EDT 2009


Ah, I see.
The reason I have to use my style is the same as others: the list is
too long....

On Mon, Oct 26, 2009 at 11:27 AM, Daniel Fischer
<daniel.is.fischer at web.de> wrote:
> Am Montag 26 Oktober 2009 03:39:13 schrieb Magicloud Magiclouds:
>> Hi,
>>   In case of this:
>> case bala of
>>   [ bala
>>   , bala
>>   , bala ] -> bala bala bala
>>   _ -> bala
>>   ghc 6.10.4 would fail to compile, because of the wrong indent of
>> line ", bala".
>
> Yes. It must, because the `of' opens a new layout block, so a line indented to the same
> level as the opening square bracket starts a new definition and it tries to parse it as
>
> case bala of
>    { [ bala;
>      , bala;
>      , bala ] -> bala bala bala;
>      _ -> bala;
>    }
>
> What about
>
> case bala of
>    [ bala, bala, bala ]
>        -> bala bala bala
>    _ -> bala
>
> ?
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
竹密岂妨流水过
山高哪阻野云飞


More information about the Haskell-Cafe mailing list