Add Zero and One to Data.Functor (mirroring V1, U1)

Ryan Scott ryan.gl.scott at gmail.com
Thu Jan 26 01:36:33 UTC 2017


You linked to the Trac issue [1], but for the purposes of motivating
this proposal, I think it's important that we reiterate why you want
this.

First of all, I think we should be clear that you're proposing to add
these in the modules:

* Data.Functor.One
* Data.Functor.Zero

Right? Not literally "Data.Functor", as the title might mislead you
into believing.

Also, for a reason why you might want these - there are currently
analogs in the GHC.Generics [2] module:

* data U1 a = U1 -- isomorphic to One
* data V1 a -- isomorphic to Zero

But this is an unfortunate situation, since I'd rather not recommend
that folks import a generics library to use what should be
general-purpose datatypes.

Now, as for the proposal itself:

* I'm weakly +1 in favor of Zero. I think it'd be nice to have a
proper * -> * counterpart to Void in base (that isn't V1, obviously).
* I'm weakly -1 in favor of One, simply because we already have
Data.Proxy, which came first.

Ryan S.
-----
[1] https://ghc.haskell.org/trac/ghc/ticket/13177
[2] http://hackage.haskell.org/package/base-4.9.1.0/docs/GHC-Generics.html


More information about the Libraries mailing list