purescript-exists
purescript-exists copied to clipboard
Add Exists2, Exists3... ?
In case you want to hide two type arguments, the best I could figure out to do with the existing Exist
is:
data Sample a b = Sample a b
newtype Sample' a = Sample' (Exists (Sample a))
type Sample'' = Exists Sample'
Does anyone know a better way? If not, I would suggest to add something like this:
foreign import data Exists2 :: (Type -> Type -> Type) -> Type
type role Exists2 representational
mkExists2 :: forall f a b. f a b -> Exists2 f
mkExists2 = unsafeCoerce
runExists2 :: forall f r. (forall a b. f a b -> r) -> Exists2 f -> r
runExists2 = unsafeCoerce
You can use it like this:
data Sample a b = Sample a b
type Sample' = Exists2 Sample