Closed gelisam closed 1 year ago
The latter is supported by Some (Flip Either Int)
I believe. The former is "supported" to the extent that we can uncurry data types:
type Uncurry :: (x -> y -> *) -> (x, y) -> *
data Uncurry f
where
Uncurry :: f a b -> Uncurry f '(a, b)
type TheFirstThing = Some (Uncurry Either)
Although this sometimes tends to run into issues.
Yeah, I think such Flip
and Uncurry
tricks are good enough until https://github.com/ghc-proposals/ghc-proposals/pull/473 exists.
Some
can only expressexists a. Either Int a
, but not the other two (at least not very easily).I stumbled upon some old code of mine which supports all three and more, using two transformers I call
SomeT
andThisT
:exists a. Either Int a
~Some Either
exists a b. Either a b
~SomeT Some Either
exists a. Either a Int
~SomeT (This Int) Either
I thought you might want to steal those ideas to make this package useful in more cases. I bet it would be easy to implement a third transformer which would support constraints too:
exists a. Show a => Either a Int
~ConstrainedT Show (This Int) Either