[Haskell-beginners] infix and bind pseudonym
codetojoy at gmail.com
Wed Mar 4 07:25:06 EST 2009
I have a simple type called Beverage and an example that allows me to
construct Maybe Beverage types.
Here are some type signatures for example functions:
request :: String -> Maybe Beverage
addMalt :: Beverage -> Maybe Beverage
I have defined a chain function like so:
chain :: (Maybe a) -> (a -> Maybe b) -> (Maybe b)
chain = (>>=)
I can do this:
(chain (request "beer") addMalt)
request "beer" `chain` addMalt
I think I understand why, as I use the back-ticks for infix.
However, I don't have to do that for the true bind function, (>>=)
request "beer" >>= addMalt
I would like to use chain in this way -- that is without back-ticks. I'm
not sure how...
Is there something I'm missing?
ps. Thanks to everyone for the great discussion on IO (re: previous
http://codetojoy.blogspot.com: Putting the thrill back in blog
http://youtube.com/ocitv -> Fun people doing serious software engineering
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners