fun x = case x of 0 -> "zero"; 1 -> "one"; otherwise -> "many"
By "otherwise" I meant "_". Surprisingly, it seems to work how I intended.
Now I don't understand how - taking into account that "otherwise" has Bool
value True, there must be type error here! Or is this word means something
different when inside a case statement?
I don't know Haskell, but in some languages (f.ex. Scala) 'otherwise' is
seen just an identifier for an immutable value that is bound to anything
x happens to be. The _ is just a special case that skips the binding.
If you have 'otherwise' already defined in same scope, lowercased
identifier in match will become a new, shadowing identifier (not sure if
'shadow' is right term).
- Henrik
"rincewind" <fa...@not.real> wrote in message
news:erfgcv$1s9s$1...@news.mtu.ru...