Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Exists2, Exists3... ? #20

Open
m-bock opened this issue May 14, 2023 · 0 comments
Open

Add Exists2, Exists3... ? #20

m-bock opened this issue May 14, 2023 · 0 comments

Comments

@m-bock
Copy link

m-bock commented May 14, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant