[Haskell-beginners] infix and bind pseudonym

Michael Easter codetojoy at gmail.com
Wed Mar 4 07:25:06 EST 2009


Folks,

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)

and

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?

thanks
Mike

ps. Thanks to everyone for the great discussion on IO (re: previous
question)

-- 
----------------------
Michael Easter
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...
URL: http://www.haskell.org/pipermail/beginners/attachments/20090304/9f5050a2/attachment.htm


More information about the Beginners mailing list