User-Defined Types

Matthias matthias.pfeifer@post.rwth-aachen.de
Wed, 1 May 2002 16:52:07 +0200


Hello,

I am a student of computer science at the university of Aachen in
Germany and presently do a course about functional programming in
haskell. I just wanted to introduce myself, because it is likely to
happen that my posting apear frequently in the next couple of month.

So my first question is about User-Defined Types. Stating the Gentle
Introduction to Haskell 98 (2.2) , i already know that:

"Type Constructors and date Constructors are in seperte namespaces. [example]"

But according to the chapter (2.2.1) "Recursive Types" i see the
polymorphic definition of a tree is:

	data Tree a = Leaf a | Branch (Tree a) (Tree a)

where (Tree a) is obviously the data-constructor out of "the other
namespace". I guess that the () is warping Tree a from the
"data-constructor-namespace" into the "type-constructor-namespace".
Since the gentle-intro implicitly uses (), which i am not used to - i
would be happy about some hints about (). That might not be to
difficult, i hope. Also i would not regret some hints about "->" which
is used in function-type-definitions. I would prefer writing

	plus :: a,a -> a 

instead of the ->-variant in order to stress the distinction between 
arguments and returned type. What is meant that -> is "associating to 
the right"? Is there a name for '->'?

Sincerely Matthias Pfeifer