>I have longstanding dislike of Haskell's expression conditional:
> The problem comes when several conditions are
> present, provoking a rightward march. In this case I use
>
> if test1 then
> part1
> else if test2 then
> part2
> else
> part3
>
> but I don't like it (the conditional expressions are not lined up and
> they tend to be buried in thickets of else-if-then keywords).
You can define your own "sequential if" a la Hoare:
data GuardedExp a = Bool :? a
seqif :: [GuardedExp a] -> a
seqif [True:?a] = a
seqif ((b:?a):x:xs) = if b then a else seqif (x:xs)
and then you can write:
seqif [
test1 :? part1,
test2 :? part2,
test3 :? part3
]
doing your proposal just another way of write this.
As pointed out by Tommy Thorn, re-using case will be confusing
and redundant.
Pablo E. Martinez Lopez (Fidel).