Symbols in Haskell

10,462

Here's a list of the reserved keywords in Haskell. The =<< that you're asking about is merely a function, so we can ask Hoogle. It tells us that =<< is simply >>= with its arguments reversed. >>= is a fundamental monad function ("monadic composition") that you can read about in many places, including LYAH.

Share:
10,462
Donna
Author by

Donna

Updated on June 04, 2022

Comments

  • Donna
    Donna about 2 years

    I have a problem in understanding a symbol in Haskell:

    =<<
    

    as in:

    -- return the last ten lines of a file
    tail10  = drop =<< subtract 10 . length
    

    can anyone explain to me what this means?

    Also I find this happens alot when I'm studying Haskell is that i bump into one of these symbols I have no idea what they mean or how they work. Is there a site or a tutorial that goes into greater depth concerning only the symbols in Haskell rather than the functions themselves?

  • Donna
    Donna over 11 years
    thank you gspr, this keyword list is exactly what I was looking for :D
  • gspr
    gspr over 11 years
    When/if hammar writes down his comment as an answer, you really should accept that instead. He actually answers what drop =<< subtract 10 . length does, which I avoid.
  • rickythesk8r
    rickythesk8r over 11 years
    Maybe "reserved keyword" is not the best characterization of =<<. The Haskell Report, section 2.4 Identifiers and Operators, defines (among other lexemes) "reservedid" (case | class | data [and so on]) and "reservedop" (.. | :: | = [and so on]). >>= and =<< are neither of these. What are they, then? >>= is a method exported from Control.Monad (section 13.1) and =<< is a basic Monad function (section 13.2.2).
  • gspr
    gspr over 11 years
    @rickythesk8r: The "these" in my first sentence refers to what the link points to, not to =<< and friends. I'll edit to make this clearer.
  • rickythesk8r
    rickythesk8r over 11 years
    @gspr: My mistake. I misunderstood the original question as -- paraphrasing -- "I don't understand what =<< means and would like to consult a 'keyword list' to find out."