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

Defunctionalization of type families #105

Open
langston-barrett opened this issue Mar 28, 2021 · 3 comments
Open

Defunctionalization of type families #105

langston-barrett opened this issue Mar 28, 2021 · 3 comments

Comments

@langston-barrett
Copy link
Contributor

langston-barrett commented Mar 28, 2021

The technique of defunctionalizing type families to support partial application (and especially higher-order type families) has been applied in at least two parameterized-utils-adjacent spots: #103, and the CtxFuns module mentioned in #84. Seems like it's probably worth creating a small module in parameterized-utils that at least provides a canonical home for the Apply family:

data TyFun a b
type a ~> b = TyFun a b -> Type
type family Apply (f :: a ~> b) (x :: a) :: b
@RyanGlScott
Copy link
Contributor

Alternatively, we could just depend on the singletons library, which provides this in Data.Singletons. singletons-3.0 and later have no external dependencies, so it's a pretty lightweight dependency.

@travitch
Copy link
Contributor

Yeah, there is also a version in semmc somewhere, I think. It would be nice to have just one. I'm open to singletons core now that it has slimmed down.

@masaeedu
Copy link
Contributor

FWIW I would find it very useful to have defunctionalization boilerplate that isn't entangled with the rest of singletons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants