-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Foldable and Functor #54
base: development
Are you sure you want to change the base?
Foldable and Functor #54
Conversation
@@ -16,6 +16,7 @@ typeclasses: | |||
- enumeration | |||
- string-representation | |||
- monoids | |||
- iteration | |||
- constructor-classes | |||
- functors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would seem that this lesson is absorbed by the current one, is that right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's right. I had previously used "iteration" as the tag when the lesson was going to lead up to Traversable, since the whole thing was going to build up to what has been described as "essence of the iterator pattern", but since dropping Traversable from the lesson I renamed it from "iteration" to "constructor-classes".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realise now that the GitHub UI isn't the best when I thought I had highlighted one particular line. The functor
lesson is also absorbed, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. The one called "functors" is Applicative/Monad.
@chris-martin Just for my understanding, how does the part about As far as I can see the ground covered here goes a long way toward a lesson about folds. Sure, I could imagine additional contents tying up some loose ends about practical use-cases (i.e. early termination/recursion with What do you think? |
@why-not-try-calmer The biggest question we don't answer in this lesson, because I think it's too difficult and too detached from the larger aim of covering the core typeclasses, is how you should decide whether to use a left/right or strict/nonstrict fold. We also don't at all discuss how What I was envisioning was a separate lesson dedicated to non-strict evaluation, that would cover a lot of the same stuff that the |
I've gotten through
Foldable
andFunctor
, and I think it's best to cut this lesson off there - this one doesn't need to get any longer than it already is, andTraversable
will really work better in a new lesson afterApplicative
andMonad
. I had originally thought I could get through an introduction to traversal by just always usingIO
as the context and hand-waving over theApplicative
constraint, but the more I think of it the more I think we need to get toApplicative
/Monad
first to solidify the "action" concept and to get to expand the set of tools we can use in example code.This lesson is now retitled to "Constructor class basics: Foldable and Functor" because that's really the common theme here, how to think about what a constructor class is.
Functor
is the classical introduction to constructor classes, but it's a little bit overly mind-bending due to the number of type parameters involved as we shift from one container type to another, and because it requires generalizing over two different conceptual metaphors, containers and actions. Starting withFoldable
(and sidestepping most of its complexity) I think offers a more gentle ramp appropriate to the fairly quick pace of haskell school. It's easier to get a grasp on what kinds of things areFoldable
because this class pretty much only describes container data structures.