Haskell is easy - a list of recommended Haskell libraries
To make it more true that Haskell is easy, here's a list of curated libraries. In the personality descriptions matching you to a library, be honest with yourself about where you're at and what your needs are.
This isn't listing for listing's sake. I've either used it or someone whose taste and experience I really trust has used it. If you list everything, the list is useless to somebody that can't sniff test the API quickly.
I wrote Haskell book. I mention where things in this list (which is very opinionated) are covered in the book. I don't care if you buy our book.
Getting Haskell installed
Basic data structures
- criterion is a library for benchmarking. Criterion uses statistics to help prevent you lying to yourself.
- Covered along with basic data structures in haskell book.
Stuff that is somewhat opinionated about how your data looks over the wire
I wanna write my own!
- Use the bytestring library and the builder API.
Command-line argument parsing
- optparse-applicative is a command-line arguments parser library - easy flag/switch definitions and automatically creates useful help pages
Concurrency / synchronization
See the note on concurrency to learn more.
- Bloodhound note you'll have to use Aeson version 0.10 or newer.
- ByteString's core modules have the basic IO operations you'd need included.
I just got here and don't know what I'm doing
Know what I'm doing and I'd like more fine-grained control over resources, such as streaming
Please see the note on streaming before using any streaming libraries.
- lens you'll have to cargo cult early on and it's best if you're not a beginner, but there's nothing better if it's something you're going to use instead of framing the source code and mounting it over your fireplace.
- chatter a collection of simple Natural Language Processing algorithms.
- Covered in Haskell book in the chapter on parsers.
I'm new and just want to throw a query over the wire!
I'm not totally new to Haskell and willing to invest in something more type-safe!
- Persistent combined with Esqueleto as appropriate.
- Yesod book chapter on Persistent
- For Esqueleto? You're going to trip up a bit early on, especially with the join order. Try to accumulate example code you can work from.
Take the note on streaming under advisement. Don;t
- If you find yourself commonly checking typeclass laws
- Also covered in Haskell Book's testing chapter and used throughout the chapters on monoid, semigroup, functor, applicative, and monad.
Text / strings
- Use text if you're going to have a non-trivial amount of textual data in memory, but don't freak out about using the String type for small stuff. Sometimes String is faster anyway because of GHC's optimizations for lists.
- Funnily enough, time is the foundational library.
I need something faster than time or I use a lot of timestamps!
- thyme's your bag.
Utility libraries and conveniences
classy-prelude can save you some grief, particularly around mixing IO, String, ByteString, and Text. Best used with a project template that disables Prelude by default and gets an import module in place for you.
I just need to make a tiny API or I just started
I'm going to make a web application I have to maintain and I'm comfortable with a more opinionated framework
- Yesod also better for APIs if you can handle something more advanced than Scotty.
Note on concurrency
For learning how to write parallel and concurrent programs in Haskell, Marlow's book is peerless.
Note on streaming
Pipes is generally easier to use than Conduit and can be quite pleasant. However, if you're new to Haskell you should avoid using streaming libraries unless necessary to control memory usage. Mostly because you'll spin your wheels on which operator to use and the type errors won't help much. YMMV.