love-haskell / coercible-utils

Utility functions for Coercible types
https://hackage.haskell.org/package/coercible-utils
BSD 3-Clause "New" or "Revised" License
9 stars 3 forks source link

Figure out the upgrade/op story #41

Open treeowl opened 4 years ago

treeowl commented 4 years ago

We want to have, in the Newtype module,

-- or re-export this from the Wild module with just Coercible?
upgrade1 :: Newtype n o => o `to` n -> o -> n

upgrade2 :: (Newtype n o, Newtype n' o', Similar n n') => o `to` n -> o' -> n'

-- or re-export this from the Wild module with just Coercible?
op1 :: Newtype n o => o `to` n -> n -> o

op2 :: (Newtype n o, Newtype n' o', Similar n n') => o `to` n -> n' -> o'

But what should each of these be named?

treeowl commented 4 years ago

The fancier versions are of relatively limited utility, to be honest. Maybe we don't actually need them? I currently use upgrade2 to explain what underF and overF do for covariant and contravariant functors, but that doesn't seem worth the trouble of export. Aside from that: they could be used to construct certain HOF arguments to ala, but by the time that's done the convenience of ala seems to have been lost.... The alap idea I had might be a better way of doing that sort of thing, but I don't know of an actual application for it at present.

kozross commented 4 years ago

I'm in favour of re-exporting from Wild, unless there's significant benefit to be had in separating them out like that. However, I also think that adding stuff for the sake of adding it (particularly given what you've said about them being of limited utility) is probably not the best plan - better to keep things simple and coherent.