[Haskell-cafe] On to applicative
nowgate at yahoo.com
Sat Sep 4 14:06:54 EDT 2010
The two myAction functions below seem to be equivalent and, for this small case, show an interesting economy of code, but being far from a Haskell expert, I have to ask, is the first function as small (code wise) as it could be?
deriving (Show, Read, Eq, Enum, Ord, Bounded)
-- myAction :: IO Color
-- myAction = getLine
-- >>= \str -> return (read str :: Color)
myAction :: IO Color
myAction = read <$> getLine
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe