[Haskell-cafe] bottomless Top?
Jonathan Cast
jonathanccast at fastmail.fm
Thu May 15 20:13:26 EDT 2008
On 15 May 2008, at 4:29 AM, Conor McBride wrote:
> 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
As I've mentioned before, my favorite data type
newtype One = One One
does the same, and stays in Haskell 98. (And has the same weakness
to seq: (`seq` ()) is perfectly strict (it's const undefined)).
jcc
More information about the Haskell-Cafe
mailing list