[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Just for your fun and horror
Perhaps I mentioned that I use Haskell to teach compilation,
since I think that functional structures are good not only
for parsers, but for a legible semantics for virtual machines,
for the code generators, etc. The main assignment was to write
a syntactic converter from a Haskell-like language to Scheme,
and the exam included such exercises as
Find the type of fm in
fm _ z [] = return z
fm g z (a:aq) = g z a >>= \y->fm g y aq
When I started correcting the exam, I thought I would jump
out of the window. First 30 copies: The type of fm is
ff -> b -> [c] -> b
(with an appropriate constraint for the functional type ff).
The result had for them the same type as the type of z.
My inquiry proved beyond any doubt that my students are so
conditioned by "C", that despite the fact that we worked with
monads for several weeks, they *cannot imagine* that
"return z"
may mean something different than the value of "z".
Any suggestions?
[Yes, I have one! Stop teaching, find a more appropriate job,
e.g., cultivate genetically modified, mutant tomatoes.]]
Jerzy Karczmarczuk
"C"-aen, Fran-"C"-e.