On Sat, 2 Oct 2010, Colin Paul Adams wrote:

"Max" == Max Bolingbroke <batterseapo...@hotmail.com> writes:

   Prelude> (if then "Haskell" else "Cafe") False
   Max> "Cafe"

My reaction is to ask:

Can you write this as:

(if then else) False  "Haskell"  "Cafe"

?

Sure:

ifThenElse :: Bool -> a -> a -> a
ifThenElse True  x _ = x
ifThenElse False _ y = y

Prelude> ifThenElse False "Haskell" "Cafe"

(I have done this in utility-ht, and called it "if'".)
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to