On 27/07/06, David Roundy <[EMAIL PROTECTED]> wrote:
Or perhaps (?:) or something like that, which could be used infix to
evoke the idea of C's e1 ? e2 : e3 syntax.  "provided" to me is less
clear than "cond" since it has other meanings, and isn't borrowed from
any language that I'm familiar with, like "cond" is.

This has come up a few times on #haskell, and the consensus is that a
tertiary (?:) operator isn't possible because of the deep specialness
of (:). However, you can simulate it pretty well:

infixr 1 ?
(?) :: Bool -> (a, a) -> a
True  ? (t, _) = t
False ? (_, t) = t

Then you call it like:

length "hello" > 4 ? ("yes it is!", "afraid not")

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

Reply via email to