[Haskell-cafe] Composition Operator
westondan at imageworks.com
Mon Sep 24 22:17:13 EDT 2007
Oh, duh! The only systematically distinguishable value in every type is
undefined, but I went and excluded that value from my fake Hask* class.
Never mind, I'll stop while I'm behind! :(
Dan Weston wrote:
> Well, I did footnote in my first e-mail that:
>  I used the asterisk in the category name Hask* to exclude undefined
> values or partial functions
> [Although I think I may have flipped the asterisk convention.]
> I see what you mean by const False and const True being two different
> arrows, but now I don't know how that reconciles with the Wikipedia
> Example 3 of http://en.wikipedia.org/wiki/Initial_object
> "In the category of pointed sets (whose objects are non-empty sets
> together with a distinguished element; a morphism from (A,a) to (B,b)
> being a function f : A ? B with f(a) = b), every singleton is a zero
> object [i.e. both initial and final]."
> I thought I was being safe by "distinguishing" () as my distinguished
> element. Where did I go wrong?
> Dan Weston
> Stefan O'Rear wrote:
>> On Mon, Sep 24, 2007 at 06:47:05PM -0700, Dan Weston wrote:
>>> Of course I should have proofread this one more time!
>>>> What is a point? A point in Hask* is a type with only a single value
>>>> in it, from which all other values can be constructed. Every value x
>>>> maps trivially into a function (const x), and when you apply this
>>>> function to the (only) value of a point, you get x back. There is a
>>>> built-in Haskell type () whose only value [besides undefined] is
>>>> also called (), so we might as well take the type () as our point:
>>> Actually, a point is any one object, for Hask* it is any one monotype
>>> (e.g. (), [Int], (Char,Double)). The magic of an *initial* object
>>> (i.e. a type with only one nullary constructor such as () that has
>>> only one (defined) value) is that there is a *unique* function
>>> mapping it to any other type. But that's being greedy, since we don't
>>> need a unique function, just any one function. A forgetful function
>>> like const doesn't care which type its second argument is.
>> () isn't an initial object.
>> There are no initial objects in Hask-with-?, since every object admits
>> at least four arrows to Bool (const True, const False, const undefined,
>> and undefined).
More information about the Haskell-Cafe