Void type in base

Edward Kmett ekmett at gmail.com
Wed Jul 17 09:08:42 CEST 2013


If the proposal made it into base more or less as is, then what I could do
is release a version of void to coincide with it that was conditionally
empty so users of void would feel no change.

e.g. my transformers-compat package uses this technique to make it possible
to use the extra data types added in transformers-0.3 back under
transformers-0.2 (for users who want to span multiple platforms, such as
lens).

-Edward

On Wed, Jul 17, 2013 at 2:34 AM, Michael Snoyman <michael at snoyman.com>wrote:

> 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
>> http://www.haskell.org/mailman/listinfo/libraries
>>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20130717/100a4be7/attachment.htm>


More information about the Libraries mailing list