[Haskell-cafe] Newbie Question on type constructors

Ben Rudiak-Gould Benjamin.Rudiak-Gould at cl.cam.ac.uk
Mon Nov 1 13:19:09 EST 2004


Keith Wansbrough wrote:

 >Indeed, they are functions.  Another way of thinking about it is as an
 >"initial algebra" (technical term).  What this means is this:
 >
 >"Shape" is a set of values that contains
 >  - the result of Circle x      for all values x :: Float
 >  - the result of Square x      for all values x :: Float
 >such that
 >  - there's nothing in Shape that can't be reached this way ("no junk")
 >  - there is no value in Shape that can be reached in two
 >      different ways ("no confusion").

I think this is orthogonal to the point of contention. For all x :: 
Float, what value results when your function Circle is applied to the 
argument x? Obviously, my value Circle x. So the function Circle can be 
eliminated from the definition by inlining, yielding

 >"Shape" is a set of values that contains
 >  - the value Circle x      for all values x :: Float
 >  - the value Square x      for all values x :: Float
 >such that [...]

This is exactly how I would define Shape.

(Well, not quite -- there *are* values in Shape that can't be 
constructed this way, but that's a totally different issue.)

-- Ben



More information about the Haskell-Cafe mailing list