New type of ($) operator in GHC 8.0 is problematic
Manuel M T Chakravarty
chak at justtesting.org
Tue Feb 16 23:05:47 UTC 2016
> Richard Eisenberg <eir at cis.upenn.edu>:
>
> On Feb 16, 2016, at 5:35 AM, Ben Gamari <ben at smart-cactus.org> wrote:
>> Indeed. I'll just say that I envision that a beginner's prelude would be
>> for learning and nothing more. The goal is that it would be used in the
>> first dozen hours of picking up the language and nothing more.
>>
>> I'd be interested to hear what Richard had in mind when he has time
>> again.
>
> Yes, that's right. And, of course, it doesn't even need to be something released with GHC.
>
> I hope to have the opportunity to teach intro Haskell in the not-too-distant future. Maybe even this coming fall. Though I have yet to look closely at Chris's book, which will be one of the first things I do to prep, I suspect I'll be writing a custom Prelude for my first few weeks of the class, eliminating all type-classes. No Foldable, no Monoid, no Num. And then, by week 3 or 4, bring all that back in.
As somebody who has taught Haskell to hordes of students (literally, 1000s), I am not at all convinced that this is going to be helpful. This is for the following reasons:
* Students understand the basic idea of overloading for Num, Show, etc easily (week 1 or 2). We actually tried both doing basic overloading very early or delaying it until later. The former worked much better.
* You are not in a position to explain Foldable and probably not Monoid by week 3 or 4. So, either you need to have more than one beginner Prelude, delay overloading until much later (awkward), or we are really only talking about the impact of Show, Num, etc here.
* Changing things (i.e., one Prelude to another) always confuses some people — i.e., there is an intellectual cost to all this.
* Students will want to use Haskell on their own computers. Then, you need to make sure, they import the right Prelude and that they stop importing the beginner Prelude when you switch back to the normal one. A certain percentage of students will mess that up and be confused.
What we found works best is the following:
* Introduce the concept of overloading right away. People get that easily, because they use overloaded arithmetic functions in math, too. (Num and Show are the typical classes to explain it at.) As an example, see how we do that in the first chapter of our new Haskell tutorial: http://learn.hfm.io/first_steps.html
* Be careful in designing your exercises/assignments (esp early ones), to make it unlikely for students to run into class related errors.
Sorry for the mostly off-topic post, but since a beginner’s Prelude was mentioned here multiple times recently as a countermeasure to making the real Prelude more complicated, I just want to say, don’t put too much hope into a ”solution” you never actually tried.
Manuel
More information about the ghc-devs
mailing list