Re: Some random newbie questions

I seriously considered switching frlom Hugs to GHC for my introductory programming class this year, but in the end stayed with Hugs because of a single feature. I'm teaching beginning programmers, and for them at least, there is an overwhelming volume of names to learn -- "what's that function?" is a question they ask themselves often, as is "what's that type?". I teach them that, whenever they see a name they don't recognise, they can find out more about it using the :i command. This is a simple trick to learn, that helps them understand points they've missed and catches misapprehensions. My students also see type classes very early. I'll bet yours will too. Even if one is very careful to restrict the examples in lectures so as to avoid them (which is a bind), as soon as students try out Hugs for themselves, they will make mistakes that generate error messages referring to type classes. No problem: the question "what's that class?" can ALSO be answered by :i. Now, at the beginning students have only a very rudimentary understanding of classes. A class is a collection of types to them, nothing more. In particular, the class definition itself is of little use to them, since it often contains a very subtly chosen collection of methods (just type :i Show, for example, which students do very early). What IS useful, right from the beginning, is the list of instances. What are Num types? Oh, integers and reals. What are Show types? Oh, pretty much everything. Particularly when debugging "missing instance" errors, this is just the information you need. Unfortunately, while Hugs prints the list of instances of a class in response to :i, GHCi does not. It only prints the class definition -- which, for my students, contains no useful information. For that reason alone, I stuck with Hugs last year. Of course, later in the course there is no problem in introducing GHC as well. Students coping well are happy to learn there is a compiler available too, while those who are struggling can stay with Hugs throughout the course. I demonstrated GHC in order to show them wxHaskell (which was very popular with the students), but I didn't REQUIRE them to use it. How about changing the behaviour of :i, Simon, so I can use GHCi throughout next year? John

On Mon, 10 Jan 2005, John Hughes wrote:
What IS useful, right from the beginning, is the list of instances. What are Num types? Oh, integers and reals. What are Show types? Oh, pretty much everything. Particularly when debugging "missing instance" errors, this is just the information you need.
Good idea! What I also would like to see is the Haddock documentation string of a function printed by ":info" or some other command.

On Mon, 10 Jan 2005 10:30:46 +0100 (MEZ), Henning Thielemann
What I also would like to see is the Haddock documentation string of a function printed by ":info" or some other command.
Now _that_ would be truly useful. /S -- Sebastian Sylvan +46(0)736-818655 UIN: 44640862

On Mon, 10 Jan 2005 10:15:57 +0100, John Hughes
<snip> How about changing the behaviour of :i, Simon, so I can use GHCi throughout next year?
Agreed. GHCi also produces what can be perceived as "odd" output when typing, for instance, :i + -- + is a method in class Num infixl 6 + (+) :: forall a. (Num a) => a -> a -> a What I'm referring to is of course the "forall a." which confuses newcomers. Personally, I'd also like a graphical interface with similar features as winhugs (mainly the "recently opened files list" and a graphical way to alter settings), but maybe that's just me... /S -- Sebastian Sylvan +46(0)736-818655 UIN: 44640862
participants (3)
-
Henning Thielemann
-
John Hughes
-
Sebastian Sylvan