Zhanyong> I was lucky to spot the source of the problem quickly
Zhanyong> because I knew I recently changed that line, but in general,
Zhanyong> this kind of error can be very hard to locate. (In my case,
Zhanyong> the offending code is 600 lines away from where the bug is
Zhanyong> manifested,
> Can't we require that a local definition be more indented than the
> enclosing definition?
It is required in Haskell'98. You have stumbled on a bug in Hugs,
which you should report to the maintainers.
Regards,
Malcolm
___
Haskell mailing list
[E
| > | mcompare x y =
| > | do i <- x ==~ y
| > | if i then return EQ else do
| > | i <- x <=~ y
| > | if i then return LT else do
| > | return GT
|
| The reason you didn't understand it the first time is because you
Malcolm writes:
> To be honest, I consider the first of these variants to be an ugly and
> confusing misuse of layout, and the second to be clear (if not the most
> beautiful way to code it). The first seems to be trying to simulate a
> C-style `return', which is in reality not at all like the t
| > | f x = case x of
| > | (a,b) -> case a of
| > | (c,d) -> case b of
| > | (e,f) -> [c,d,e,f]
| >
| > You can't be serious! This is a great example of mis-using layout to
| > baffle and bemuse.
|
| I belive he is as it is very similar to
|
| {- code -} >>= \(a,b)
Malcolm Wallace wrote:
>
> | mcompare x y =
> | do i <- x ==~ y
> | if i then return EQ else do
> | i <- x <=~ y
> | if i then return LT else do
> | return GT
> | with strictly increasing indentation iut would have
Try this variation on the same theme:
>
> mcompare x y =
>do i <- x ==~ y
> if i then return EQ else do i <- x <=~ y
> if i then return LT else do return GT
>
> This code now has a very serious bug!
The code is illegal, isn't it? The