I'm just starting to learn Haskell and would find it very helpful to see how Haskell functions are implemented. I've been able to find the Standard Prelude on different question, but I'm now interested in Data.List. Is there any way to find the source for these functions?
I would really like to see permutations and nub (and the rest, but these are the most interesting for me right now).
Here you go: http://hackage.haskell.org/packages/archive/base/latest/doc/html/src/Data-List.html
More generally, if you look at the documentation page for Data.List
you'll see "Source" links to the right of the type signatures, which will take you directly to the source for that function.
You can find the source for the rest of the standard libraries the same way and, in fact, for nearly everything on Hackage.
The documentation of the Data.List module is found here: http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-List.html
And the source here: http://www.haskell.org/ghc/docs/latest/html/libraries/base/src/Data-List.html
In GHCI, you can do :browse Data.List
to find more about this module. Note that the basic list definitions and operations are also found in base packages e.g. GHC.Base, GHC.List.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With