开发者

What are the most important abstractions in Haskell? Monads? Applicatives? [closed]

开发者 https://www.devze.com 2023-03-05 17:50 出处:网络
Closed. This question is opinion-based. It is not currently accepting answers. 开发者_如何学Go Want to improve this question? Update the question so it can be answered with facts and citati
Closed. This question is opinion-based. It is not currently accepting answers. 开发者_如何学Go

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 5 years ago.

Improve this question

I want to know which libraries, functions, and concepts I definitely should know about and how to use. Monad and the functions there is the typical example, but there are other good primitives to use in coding, like Arrows, Applicative, ... Who are they?

btw, I want to be up-to-date in the Haskell world, learning the new concepts, how is this done?

(the original title was: "Library primitives for coding", but this was changed)


The best way to start your Haskell experience is to install The Haskell Platform, which has many of the libraries we think are important.

  • The library documentation
  • Other advice for learning Haskell

If you look at what abstractions ship in the base system, you'll see some things worth learning:

  • Control.Monad
  • Control.Applicative
  • Control.Arrow
  • Data.Monoid
  • Monad transformers
  • The ST Monad

And don't forget the powerful tools:

  • Concurrent programming
  • Transactional memory
  • Deterministic parallelism


Basic libraries to know:

  • base (Prelude module, etc)
  • Monad Transformer Library, mtl or the MonadLib.
  • containers

Common data-centric libraries:

  • cereal / binary / blaze-builder
  • Vector
  • unordered-containers

Packaged concepts that you should know:

  • Monads, Monad Transformers (see base, mtl)
  • Applicative (see base)
  • Arrows (see base)
  • Software Transactional Memory (stm)
  • Extensible Exceptions (in base since ~GHC 6.8)
  • Dynamic programming in Haskell (See Data.Typeable in base)
  • Sparking (light-weight parallelism hints via parallel)
  • Concurrency (see Control.Concurrent in base)
  • Memoization (monad-memo, MemoTrie)

Semi-advanced concepts:

  • Functional Reactive Programming (reactive-banana, netwire)
  • Iteratees (enumerator)
  • Generic programming (syb, uniplate, etc)

Testing, benchmarking, and infrastructure:

  • criterion (benchmarking tool)
  • quickcheck, lazysmallcheck (property tests)
  • cabal and hackage

External tools, GHC helpers, GHC

  • threadscope
  • alex (lexer)
  • happy (a parser generator)
  • haddock (documentation system)
  • Haskell Program Coverage (HPC)
  • GHC manual, which includes information on things like
    • Different back-ends
    • Profiling
    • Debugging
    • Optimization
    • Language extensions

Type-centric knowledge

  • GADTs
  • Rank-N Types
  • Existentials
  • Functional Dependencies and Type Families
  • This list can go on and on, but you'll know where to look if you know the above.

How to stay up-to-date on Haskell without asking a stack-overflow question:

  • Read the papers accepted by ICFP and POPL
  • Read the papers rejected by ICFP and POPL (if you can find them)
  • Connect on the social networks, Haskellers seem big on
    • Twitter (start by following whoever follows Galois or any random Haskeller you know)
    • Reddit
    • Stack Overflow (message me if you need a link)
  • Read blogs (linked from reddit or planet.haskell.org)
  • Follow conversations on the haskell-cafe mailing list or IRC.
  • Attend Galois semi-weekly tech talks


I actually sketched a list/grouping of Haskell-related things by their practical importance a while ago; it looks like this:

Haskell Basics (necessary for anything)

  • Functions
  • Partial application, currying
  • Recursion
  • Higher order functions
  • Algebraic datatypes
  • Pattern matching
  • Type classes
  • Kinds
  • Functors
  • the IO monad

Practical Necessities (you'll probably need to know about these for Serious Work, even if per chance you don't use all of them)

  • Monads
  • Monad Transformers
  • The FFI
  • Laziness/Strictness, BangPatterns and the rest
  • GADTs
  • TypeFamilies
  • FunctionalDependencies

Not Necessarily Necessary, But Probably Useful

  • Applicative
  • Higher-Rank Polymorphism
  • OverlappingInstances
  • Lenses and alternate record systems (fcLabels and the rest)
  • Iteratees
  • Concurrent Haskell (forkIO, MVars, ...)
  • Software Transactional Memory
  • TemplateHaskell
  • RULES

Extracurricular (potentially fascinating but wholly unnecessary)

  • Arrows
  • Functional Reactive Programming
  • Comonads, categories, morphisms, and other general abstract nonsense
0

精彩评论

暂无评论...
验证码 换一张
取 消