Where to go from here - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Pedro Minicz

I've been playing with Haskell for one and a half years now. I believe I have a good grasp of the basics and I am aware of many concepts. I keep seeing people talk about stuff like effect systems, recursion schemes, and lenses. I believe there is more to these concepts than simply using some library.

I'd like to learn how to use those concepts (and others). I'd love to hear suggestions on how/where to learn those concepts. I am a theory/project driven learners, so I'd love to get some pointers to learning material and some interesting project suggestions to apply those projects.

Also, I don't know exactly how to name what I know/what I have used. I've seen people say stuff such as "I've learned mtl", which I find a bewildering claim. I've used mtl, but haven't dealt with big monad transformers stacks, for example, so I don't feel confident in saying "I know mtl" (or if that statement even makes sense).

Georgi Lyubenov // googleson78

what are your biggest pain points with hs so far?

Peter J. Jones

I think it's worth noting that you can write amazing Haskell programs without ever learning or using any of those technologies. There's even a (smallish?) movement to push back against some of those advanced techniques called Simple Haskell.

It seems to me that the community is always going to be talking about and using some technology, technique, or abstraction that I've never heard of. I think Haskell attracts people that are interested in learning and who are always pushing themselves to write better code whether it's using cutting edge research or some forgotten technique from the 1920s.

Here's my advice to you:

  1. Keep writing code. It's okay that you don't know those things right now.

  2. When you hear a new term or technology being thrown around don't be afraid to ask for a link to a tutorial or for someone to define what they are talking about. Then do a little reading and don't be hard on yourself if nothing makes sense on the first pass. Come back here and ask questions! You may even want to keep a to-do list of the techniques you've heard mentioned that you want to follow up on.

  3. Keep writing the code you've already been writing. Just because you've heard of a new technique doesn't mean it belongs in your code. It's really easy to destroy a project by introducing each new concept that you've learned. (I know, I've done it.)

  4. Create some test projects where you can experiment with some of the new ideas that you are learning. I'm sure you're excellent at learning abstract concepts but writing code and making things concrete will really help you know when to put a technique into practice.

Vincent L

Try "Category Theory for Computer Scientist" from Barr and Wells, it's in pdf form freely available from the author university, and it's very well written. It introduces category theory concept, some of them are maybe not useful in Haskell, but at least it gives some perspective

Pedro Minicz

Georgi Lyubenov // googleson78 said:

what are your biggest pain points with hs so far?

Monad stacks quickly get unwieldy.

TheMatten

Haha, that's when we point you to #Polysemy :big_smile:
It's slightly unfortunate that way Haskell tends to be written often makes us think in context of explicit stack
We do want composable primitives for building bigger contexts, but we don't want to write in terms of them - instead, we usually think in terms of unordered capabilities we need at hand

TheMatten

I imagine design similar to Koka or Unison may be something that could shift ergonomic approaches that way

Pedro Minicz

I was wondering about that because I happen to have read about Koka and effect systems in Haskell recently.

Pedro Minicz

I wonder if they share the same basic theory.

TheMatten

Way I look at it is that strictness and blocks implicitly define ordering of operations described by Applicative/Monad interface in Haskell - when it comes to underlying monad, in case of these two it's probably going to be similar to https://github.com/hasura/eff in principle

🚧 a work in progress effect system for Haskell 🚧. Contribute to hasura/eff development by creating an account on GitHub.
TheMatten

(side note: continuations are worth a look :big_smile: )

Sridhar Ratnakumar

Anybody use eff in production?

TheMatten

I guess no, simply because you would have to use forked compiler without support ATM :smile:

Manuel Bärenz

For a library similar to eff that works well with current mainline GHC, see https://hackage.haskell.org/package/fused-effects.

Manuel Bärenz

Pedro Minicz said:

I'd like to learn how to use those concepts (and others). I'd love to hear suggestions on how/where to learn those concepts. I am a theory/project driven learners, so I'd love to get some pointers to learning material and some interesting project suggestions to apply those projects.

I would recommend reading the motivating & accompanying research papers to the libraries. Haskell is an interesting hybrid between a production programming language and a research playground, and many libraries come from a fruitful fertilisation between these two.

For example, for lenses you can read about papers here: https://github.com/ekmett/lens/wiki/History-of-Lenses
For effect systems like fused-effects, look into: https://github.com/fused-effects/fused-effects#related-work and the foundational papers they link to. Many other libraries also have articles like this, and they give you a broader and more theoretical understanding of a) how the libraries work b) why they work like that. In computer science, fortunately good research papers are often very readable (as opposed to, say, maths), so often it's possible to learn something interesting from there.

Lenses, Folds, and Traversals - Join us on freenode #haskell-lens - ekmett/lens
A fast, flexible, fused effect system for Haskell. Contribute to fused-effects/fused-effects development by creating an account on GitHub.
TheMatten

For a library similar to eff that works well with current mainline GHC, see https://hackage.haskell.org/package/fused-effects.

I would say polysemy has closer interface, but you won't go wrong with fused-effects neither