[Haskell-cafe] bottomless Top?

Conor McBride conor at strictlypositive.org
Thu May 15 07:29:48 EDT 2008


Replying slap-foreheadedly to own post...

On 15 May 2008, at 11:56, Conor McBride wrote:

> Folks
>
> I'm also wondering whether it makes sense to have a
> "bottomless Top" type, with constructor _ and lazy pattern _
> (with (undefined :: Top) equal to _). Then the constant-time
> shape operator makes the same sort of sense as the
> constant-time
>
>   inflate :: Functor f => f Zero -> f a

We've got it already.

data One

would do, with smart constructor

only :: One
only = undefined

and no other operations, so no way to be strict in its values.
It's the lazy version of Zero. Assuming (safely?) that
representation of data in each instance of a type constructor
is uniform, that means

   shape :: Functor f => f a -> f One
   shape = unsafeCoerce

should be ok, right? The question about the GC implications
of that move still stands, though.

Cheers

Conor



More information about the Haskell-Cafe mailing list