New type of ($) operator in GHC 8.0 is problematic
Manuel M T Chakravarty
chak at justtesting.org
Wed Feb 17 08:59:38 UTC 2016
We have tried variations of this. This approach has two problems.
(1) It’s generally easier to use something than to define it and, e.g., in the case of lists, Haskell ”magic” syntax is more intuitive to use.
For example, we use lists for a while before we define them. Even recursive definitions with pattern matching on  and (:) are fairly easy to explain and for students to write quite a while before we discuss data declarations.
The build-in syntax for lists is convenient for using collections before properly explaining the full structure of terms and the concept of data constructors etc.
(2) We repeatedly found that any for-teaching-only definitions come with quite a bit of hidden costs.
At some point, you need to make the transition from the for-teaching-only definitions to the ”real” definitions. At this point, you invariably lose the students who managed to just get everything up to that point — i.e., those students that were struggling anyway. For us, alpha renaming is a trivial process. However, learners (and esp. the weaker learners) are rather tied to syntax and concrete names. They don’t deal well with alpha renaming.
Additionally, by introducing for-teaching-only definitions, you basically cut learners of from all the online resources that they could otherwise access. You probably won’t be able to match it up with a textbook unless you write one yourself. (Even if there is a book, this book then becomes the only resource.) This is an enormous disadvantage.
> Joachim Breitner <mail at joachim-breitner.de>:
> Am Mittwoch, den 17.02.2016, 10:05 +1100 schrieb Manuel M T Chakravarty:
>> * Be careful in designing your exercises/assignments (esp early
>> ones), to make it unlikely for students to run into class related
> have you, or someone else, considered or tried to simply have students
> start with their own list data type, i.e.
> data List a = Nil | Cons a (List a)
> and have them implement the combinators they need themselves? Of
> course, you’d have to tell them to use names that do not clash with
> Prelude-exported, but this would avoid Foldable et. al. and be more
> educational (at the expense of maybe a slower progress, and not having
> nice syntax).
> Similarly, one could teach them about the non-magicness of $ and side-
> step the issue with $ by having them write
> ($$) :: (a -> b) -> a -> b
> f $$ x = f x
> infixr 0 $
> (or whatever symbol they fancy).
> This would be akin to using a beginner’s prelude, only that the
> students would be writing it themselves, which IMHO is a big difference
> from an educational point of view.
> Joachim “nomeata” Breitner
> mail at joachim-breitner.de • https://www.joachim-breitner.de/
> XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F
> Debian Developer: nomeata at debian.org
> ghc-devs mailing list
> ghc-devs at haskell.org
More information about the ghc-devs