[Haskell-beginners] <-
Patrick Redmond
plredmond at gmail.com
Fri Aug 31 05:00:52 CEST 2012
I'm reading "Learn You a Haskell for Great Good!", chapter 9, "Input
and Output" <http://learnyouahaskell.com/input-and-output>.
IO actions are given liberal coverage throughout the chapter, however
it is never mentioned whether the value-extractor syntax (<-) has a
type or not.
main = do
x <- getLine
putStrLn $ reverse x
In this little program, getLine has type "IO String" and x has type
"String". This implies to me that (<-) has type "IO a -> a". However,
GHCI chokes on ":t (<-)" and Hoogle says it's just a syntactic element
<http://www.haskell.org/haskellwiki/Keywords#.3C->.
I guess I don't have a specific question, but I was kind of expecting
it to be a function with a type because everything seems to be a
function with a type in Haskell... Thanks for listening!
More information about the Beginners
mailing list