[Haskell-cafe] if-then-else as rebindable syntax (was Re: Why
does Haskell have the if-then-else syntax?)
Brandon Moore
brandonm at yahoo-inc.com
Thu Jul 27 12:32:19 EDT 2006
David House wrote:
> How about we drop the idea of an auxilary cond function, and instead
> just use a Boolean typeclass?
>
> class Boolean b where
> isTrue :: b -> Bool
> isFalse :: b -> Bool
I don't think this covers embedded languages. If everything lives in
some monad it might be useful to rebind the if syntax at a type like
DSLMonad Bool -> DSLMonad a -> DSLMonad a -> DSLMonad a
Independent of how the if syntax works, an if function would still be
handy. Maybe even both argument orders, a -> a -> Bool -> a for
transforming booleans, and to follow the standard argument order on
catamorphisms, and Bool -> a -> a where the conventional if order is good.
Brandon
More information about the Haskell-Cafe
mailing list