Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What Haskell package has a unit functor/monad?

I'm looking for the unit functor/monad

data Unit a = Unit

I could easily recreate it, but I'd rather not duplicate something this basic. It used to live in Control.Functor in the category-extras package (http://hackage.haskell.org/packages/archive/category-extras/0.1/doc/html/Control-Functor.html). I can't find it with Hoogle, or in the map of where the pieces of category-extras went to live (http://hackage.haskell.org/package/category-extras-1.0.2)

It seems like it should live in the transformers package, since that's where Control.Monad.Identity went (it's now Data.Functor.Identity).

The closest existing library code I can come up with is

type Unit a = Constant () a

using Data.Functor.Constant from the transformers package.

like image 915
Cirdec Avatar asked Sep 24 '13 00:09

Cirdec


1 Answers

The Proxy type may be what you're after.

like image 109
Anthony Avatar answered Oct 02 '22 15:10

Anthony