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

Alternative to OverloadedLabels? #29

Open
mrkgnao opened this issue Jun 17, 2017 · 2 comments
Open

Alternative to OverloadedLabels? #29

mrkgnao opened this issue Jun 17, 2017 · 2 comments

Comments

@mrkgnao
Copy link

mrkgnao commented Jun 17, 2017

I'm going through the tutorial module, and there's somewhat heavy usage of OverloadedLabels in the code that makes compiles really slow for me (similar to the case with gi-gtk). Is there an alternative (I'm willing to endure some boilerplate/prefixed record selector names/etc.) to this?

Using generic-lens might be an option: it supports things like label @"foo" using nothing but GHC.Generics, which greatly cuts down on the compile-time overhead without sacrificing any type safety. However, from my limited experience with tisch, I'm not sure how the type/data family techniques used here will interact with generic programming. (What would you even derive Generic for?)

Edit: I've found the IsLabel instances (!) which showed me what I wanted to be doing instead (in this case, something like view (col (Proxy @Foo))). Even then, I'm interested in whether there's a lower-friction API possible using generics.

@k0001
Copy link
Owner

k0001 commented Jun 17, 2017 via email

@mrkgnao
Copy link
Author

mrkgnao commented Jun 19, 2017

I've found using manually written lenses of the form

path_id :: ColLens "path_id" a b b => Lens' a b
path_id = colLens @"path_id"

works pretty well for now. (colLens is just col Proxy with some visible type applications.)

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

2 participants