How come pattern match does not recognize this code style?

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". -- 竹密岂妨流水过 山高哪阻野云飞

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 ?

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
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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- 竹密岂妨流水过 山高哪阻野云飞

On Mon, Oct 26, 2009 at 6:08 AM, Magicloud Magiclouds
Ah, I see. The reason I have to use my style is the same as others: the list is too long....
You don't have to put everything on the same line, you just have to indent the rest of the pattern a bit more than the first line :
case bala of [ bala , bala , bala ] -> bala bala bala _ -> bala
-- Jedaï
participants (3)
-
Chaddaï Fouché
-
Daniel Fischer
-
Magicloud Magiclouds