tonymorris at gmail.com
Fri Aug 31 05:10:55 CEST 2012
The (<-) symbol is syntax, so doesn't really have a type and probably
shouldn't be thought of as having one.
It's more like, given the expression that appears to its right of the
type (m a) implies that the value to its left is of the type a.
Unlike, (->) which has a kind (not a type), since it takes two type
variables to produce a type e.g. (->) Int Int is a function taking Int
Hope that helps.
On 31/08/12 13:00, Patrick Redmond wrote:
> 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
> 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!
> Beginners mailing list
> Beginners at haskell.org
More information about the Beginners