[Haskell-cafe] Obscure, important concepts

Christopher Allen cma at bitemyapp.com
Mon Nov 3 23:11:23 UTC 2014


Arguably http://chimera.labs.oreilly.com/books/1230000000929 by Simon
Marlow is pretty authoritative on concurrency and parallelism in Haskell.
As a nice bonus, it contains one of the best explanations of weak-head
normal form and laziness in Haskell.

For lenses, Joseph Abrahamson has made some excellent tutorials on his
codewars account: http://www.codewars.com/users/tel/authored
The exercises take you through inventing lenses from scratch.

Learning `lens` specifically entails learning contravariant, profunctors,
choice, traversals, etc. It's not that bad understanding `lens` once you
have a facility for algebras-as-typeclasses and have an idea of the
end-goal by having played with and built lenses independently. To see some
older forms of lenses, consider googling "semantic editor combinator". The
nomenclature is suggestive.

Macros - basically anything about quasiquoting or TH. I point people in the
same direction here as I do with Generics. Look at example applications and
uses, then write your own. Being comfortable with folding/reducing ASTs
will help a lot here. You could use Aeson's TH module as a place to start
with this.

Continuation passing style - learning how "Cont" works is a good place to
start with CPS in Haskell. It's intimidating but not particularly
complicated…subtle in ways that can defeat learners.

I'm not much of an expert on Arrows. I feel people that have used them more
(such as in arrowized FRP) might be more helpful here. I had use for
`first` recently but I only used it because the Bifunctor wasn't available.
I feel I might be stating something self-evident, but Arrows can be nice if
you're kicking around a lot of stuff that's * -> * -> * and you want to
address the types therein and not partially apply them out of scope from
the interface. Example: Bifunctor is * -> * -> * whereas Functor is kind *
-> *. This lets me choose to map over the "Left" or the "Right"
constructors of an Either, rather than only mapping over the "Right" as in
the case of the Functor.

I stash resources and useful links in my guide here:
https://github.com/bitemyapp/learnhaskell

Hope this helps.

--- Chris Allen


On Mon, Nov 3, 2014 at 4:53 PM, Jeffrey Brown <jeffbrown.the at gmail.com>
wrote:

> What concepts relatively unique to Haskell are powerful, widely
> applicable, and not mentioned in most introductory texts? (By "relatively
> unique to Haskell" I mean maybe they're part of Lisp or Scheme, but not,
> say, Java.)
>
> Some of the concepts important to Haskell, such as lambda expressions and
> recursion, are also present in more popular languages. Many others, though,
> either have no equivalent in (most) other languages, or else are very
> unlike the equivalent:
>
>     types, classes and kinds
>     higher-order functions
>     evaluation
>         partial application
>         tail recursion
>         laziness
>         currying
>         pattern matching
>         application and composition operations
>     contexts
>         functors, applicatives, monads
>         monad transformers
> *    lenses*
> *    :def macros*
> *    arrows*
> *    continuation passing style*
> *    software transactional memory*
>
> Most of those topics appear to be covered by introductory texts, but the
> last five are not. I found each of them by accident, and each kind of blew
> my mind. They all strike me as powerful, widely applicable, and obscure.
>
> Are there others?
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20141103/92051697/attachment.html>


More information about the Haskell-Cafe mailing list