Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symbols in Haskell

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?

like image 211
Donna Avatar asked Dec 01 '12 15:12

Donna


1 Answers

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.

like image 162
gspr Avatar answered Oct 15 '22 00:10

gspr