At 12:03 17/07/03 +0100, Bayley, Alistair wrote:
This is what I've turned it into to get it to work. It seems a bit clumsy;
is there a better way to write this?

> test n =
>       case True of
>               _ | n == one -> "one"
>                 | n == two -> "two"
>                 | otherwise -> "three"

The 'case' is somewhat redundant. How about:


> test n | n == one  = "one"
>        | n == two  = "two"
>        | otherwise = "three"

#g


------------------- Graham Klyne <[EMAIL PROTECTED]> PGP: 0FAA 69FF C083 000B A2E9 A131 01B9 1C7A DBCA CB5E

_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to