Void type in base

Michael Snoyman michael at snoyman.com
Wed Jul 17 08:34:26 CEST 2013

I'd recommend including this code in a different module name in base, as
that way there won't be any module name conflicts with the existing void
package. It will hopefully make it a bit easier to have this transition.

On Wednesday, July 17, 2013, Shachaf Ben-Kiki wrote:

> It seems strange that there's a canonical unit type -- () -- which is
> used extensively, but no canonical type for its dual, the uninhabited
> type. The closest we have is in Edward Kmett's void package, but
> several people seem to prefer to write it themselves rather than incur
> an extra dependency, which is a shame.
> The proposal is just to copy the Data.Void API into base:
>     data Void -- EmptyDataDecls is in Haskell 2010
>     absurd :: Void -> a
>     vacuous :: Functor f => f Void -> f a
>     -- instances for Typeable, Data, Generic, Eq, Ord, Show, Read, Ix,
> Exception
> (void also has a vacuousM for Monad, but since Functor will probably
> become a superclass, it might not be necessary to export it... By
> default it probably makes sense to include it, though.)
> void could then re-export Data.Void so packages that depend on it will
> keep working.
> ("void" also has unsafe functions -- namely unsafeVacuous, which isn't
> safe with an invalid Functor instance -- but those probably don't
> belong in base.)
> hashable and semigroups would also need to be updated to add their
> respective instances as non-orphans.
> The instances should probably be made compatible with void's. In
> particular note that void's Eq instance has `_ == _ = True`.
> Discussion period: 2 weeks.
>     Shachaf
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org <javascript:;>
> http://www.haskell.org/mailman/listinfo/libraries
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20130717/b4ce2f1e/attachment.htm>

More information about the Libraries mailing list