tomjaguarpaw / product-profunctors

Other
19 stars 14 forks source link

Use `Control.Newtype` from `newtype` #47

Open lingnand opened 6 years ago

lingnand commented 6 years ago

It seems like the Newtype class in this package can be entirely replaced by using the more widely used Control.Newtype class - or maybe I'm missing something?

tomjaguarpaw commented 6 years ago

How would you write pNewtype :: (Profunctor p, Newtype t) => p a b -> p (t a) (t b) in terms of Control.Newtype?

lingnand commented 6 years ago

I imagine something along the line of

pNewtype :: (Profunctor p, Newtype n1 o1, Newtype n2 o2) => p o1 o2 -> p n1 n2
pNewtype = dimap unpack pack

And maybe another version allowing passing in type witnesses via Newtype constructors.

Haven't tested these though.