A Pointless Library Proposal

David Menendez zednenem at psualum.com
Thu Oct 26 02:11:18 EDT 2006


Conor McBride writes:

> > magic :: Zero -> a
> > magic _ = error "There's magic, as no such thing!"
> 
> It's a little frustrating to have to define this function lazily. I
> prefer the strict definition with no lines, but it isn't valid
> Haskell!

I think you could avoid that frustration by defining Zero/Void/Bikeshed
liko so:

    newtype Void = Void { avoid :: forall a. a }

That gets you a strictly defined avoid and emphasizes that Void is
isomorphic to (forall a. a).



On a semi-related note, how about instances for the Prelude classes?

For example,
    
    instance Show Void where
        show = avoid
    
    instance Read Void where
        readsPrec _ _ = []

    instance Eq Void where
        a == b = avoid a
    
    instance Ord Void where
        compare a b = avoid a

Enum and Bounded are out, because they have methods which produce
values, but Data and Typeable instances might be reasonable.
-- 
David Menendez <zednenem at psualum.com> | "In this house, we obey the laws
<http://www.eyrie.org/~zednenem>      |        of thermodynamics!"


More information about the Libraries mailing list