<p>Short version: Where can I find highly varying, small or medium-sized exercises and examples on the use, identification and instance declaration of Haskell's abstractions such as applicatives, monads, monoids, foldables, transversables and monad transformers?</p>

<p>I have identified a serious lack of small to medium-sized exercises on Haskell's "higher abstractions," such as applicatives, monads, monoids, foldables, transversables and monad transformers. When studying, say, the use of higher-order functions such as <code>foldr</code>, many materials contain a good set of exercises, starting from simple ones and proceeding to varying levels of challenge. When it comes to the "higher abstractions," the situation is, in my humble opinion, extremely poor, even after combing through many sources and trying to extract everything that is available.</p>

<p>To help the student understand and appreciate these abstractions I would expect to see highly varying, small to medium-sized exercises. These exercises should make the student, among other things,</p>

<ul>
<li>use these abstractions</li>
<li>write instances of these abstractions</li>
<li>identify cases where these abstractions could be defined and used</li>
<li>identify cases where these abstractions can <em>not</em> be defined and used</li>
<li>compare the use of these abstractions to not using them.</li>
</ul>

<p>As background information, my two favourite materials are <em>Hutton's Programming in Haskell (2nd ed.)</em> for a solid basis and Allen's and Moronuki's <em>Haskell Programming from First Principles</em> for some of their material on more advanced topics.</p>

<p>While Hutton's <em>Programming in Haskell</em> is a superb text for the basics, a good example of what is missing is its chapter "Foldables and friends" on monoids, foldables and transversables. The exercise set does not contain a single exercise that would make the student practice the use of these abstractions. It does not contain a single exercise of identifying the existence of these abstractions in some domain.</p>

<p>These abstractions are, in my opinion, an order of magnitude more difficult to assimilate than, say, higher-order functions. There is also at least an order of magnitude difference in the number of exercises available, but it is in the wrong direction.</p>

<p>Granted, <em>Haskell Programming from First Principles</em> does make you write a lot of instances of these abstractions in classic cases. Unfortunately it missed the other parts, and made me feel a bit like having proved a bunch of lemmas with very little idea of where those lemmas might be useful.</p>

<p>I think this is relevant for the Haskell community in general. If we can find pointers to good exercises, or examples that can be turned into exercises, I can create a public github repo and start collecting the material into one place.</p>

CC BY-SA 4.0
2018-09-18T00:09:22.420Z
Welcome to [cseducators.se]. Glad you picked this site as the home for your question. While Haskell is _way_ outside my experience, I believe this is the place to find your answers, if any exist that is. I've added some tags, which you can remove if you choose, that might help sort out what others see before opening your question.
Gypsy Spellweaver
CC BY-SA 4.0
2018-09-20T01:53:58.113Z
Is http://blog.tmorris.net/posts/20-intermediate-haskell-exercises/ the kind of thing you are looking for?
Brent Yorgey
CC BY-SA 4.0
2018-09-20T15:31:05.357Z
I suggest that you ask a question like this on the SIGCSE mailing list. While the membership there overlaps with this site, you will reach a lot of additional people who may have answers.
Buffy
CC BY-SA 4.0
2018-09-22T13:14:22.567Z
@BrentYorgey Those exercises are of the "type tetris" variety, where instances are written without any application or domain context. _Haskell Programming from First Principles_ contains plenty of these. You do learn to write instances from types alone. But there is no stage where abstractions would be identified in domain, nor any idea of how they might be used.
jhu
CC BY-SA 4.0
2018-09-23T21:27:18.663Z
I see!  Yes, I am not aware of any collected exercises along those lines.
Brent Yorgey
<lesson-ideas><resource-request><functional-programming><exercises>
Small to medium scale exercises about Haskell's higher abstractions
# Small to medium scale exercises about Haskell's higher abstractions

(Asked by: username_0 on 2018-09-17)

Short version: Where can I find highly varying, small or medium-sized exercises and examples on the use, identification and instance declaration of Haskell's abstractions such as applicatives, monads, monoids, foldables, transversables and monad transformers?

I have identified a serious lack of small to medium-sized exercises on Haskell's "higher abstractions," such as applicatives, monads, monoids, foldables, transversables and monad transformers. When studying, say, the use of higher-order functions such as `foldr`, many materials contain a good set of exercises, starting from simple ones and proceeding to varying levels of challenge. When it comes to the "higher abstractions," the situation is, in my humble opinion, extremely poor, even after combing through many sources and trying to extract everything that is available.

To help the student understand and appreciate these abstractions I would expect to see highly varying, small to medium-sized exercises. These exercises should make the student, among other things,

* use these abstractions
* write instances of these abstractions
* identify cases where these abstractions could be defined and used
* identify cases where these abstractions can *not* be defined and used
* compare the use of these abstractions to not using them.

As background information, my two favourite materials are *Hutton's Programming in Haskell (2nd ed.)* for a solid basis and Allen's and Moronuki's *Haskell Programming from First Principles* for some of their material on more advanced topics.

While Hutton's *Programming in Haskell* is a superb text for the basics, a good example of what is missing is its chapter "Foldables and friends" on monoids, foldables and transversables. The exercise set does not contain a single exercise that would make the student practice the use of these abstractions. It does not contain a single exercise of identifying the existence of these abstractions in some domain.

These abstractions are, in my opinion, an order of magnitude more difficult to assimilate than, say, higher-order functions. There is also at least an order of magnitude difference in the number of exercises available, but it is in the wrong direction.

Granted, *Haskell Programming from First Principles* does make you write a lot of instances of these abstractions in classic cases. Unfortunately it missed the other parts, and made me feel a bit like having proved a bunch of lemmas with very little idea of where those lemmas might be useful.

I think this is relevant for the Haskell community in general. If we can find pointers to good exercises, or examples that can be turned into exercises, I can create a public github repo and start collecting the material into one place.

**Tags:** lesson-ideas, resource-request, functional-programming, exercises

> **Comments:**
> **username_1**: Welcome to [cseducators.se]. Glad you picked this site as the home for your question. While Haskell is _way_ outside my experience, I believe this is the place to find your answers, if any exist that is. I've added some tags, which you can remove if you choose, that might help sort out what others see before opening your question.  
> **username_2**: Is http://blog.tmorris.net/posts/20-intermediate-haskell-exercises/ the kind of thing you are looking for?  
> **username_3**: I suggest that you ask a question like this on the SIGCSE mailing list. While the membership there overlaps with this site, you will reach a lot of additional people who may have answers.  
> **username_0**: @BrentYorgey Those exercises are of the "type tetris" variety, where instances are written without any application or domain context. _Haskell Programming from First Principles_ contains plenty of these. You do learn to write instances from types alone. But there is no stage where abstractions would be identified in domain, nor any idea of how they might be used.  
> **username_2**: I see!  Yes, I am not aware of any collected exercises along those lines.  

---

## 0 answers

