-
Notifications
You must be signed in to change notification settings - Fork 1
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
Variant
and VariantF
prefixing helpers
#2
Comments
Sure! |
After a discussion on purescript-beginners channel it seems that this can be implemented by coercing into |
I'm not very familiar with VariantRep, but I don't think it should be a problem. |
I was talking bullshit. Prefixing I've this prototype (not ready for a PR) but I wonder if this polymorphic row in the result is a real problem: I think that we should get "closed row" back. What is your opinion? |
Why should the polymorphic row be a problem? Do you have a case where this breaks? |
I think that "opening" a Row of a https://github.com/paluh/purescript-record-prefix/blob/master/src/Data/Variant/Prefix.purs#L50 |
Mm right, this is pretty annoying. |
I had |
I could do this with |
So this is a version which uses typeleve-eval to precompute resulting row type: As you can see it doesn't require intermediate annotations but is a bit more complicated - we use here folding on the type level: ToRow <<< FoldrWithIndex (UnprefixStep pre) NilExpr <<< FromRow I should probably make clear distinction between these two folds strategies (one purely on type level using typlevel-eval and second on the value level using heterogeneous) used by the module by commenting them properly. |
I think it's a good approach. Despite what's written in the readme, this library never had any pretence of being fast or efficient (which could be done via FFI I guess), so I don't see any problem in adding an extra dependency. I wonder If this library should change name after this merge |
Cool! I'm going to rebase all these commits so they form a single one so I can provide a nice PR.
I don't think that this typelevel computation is going to impact runtime performance. I'm not sure how JS looks like exactly regarding the
|
Great and thank you! :)
|
Yeah, sure. I want to add support for
|
Would you like prefixing helpers for
Variant
andVariantF
to this library? I have working prototype forVariant
so I can provide a PR.The text was updated successfully, but these errors were encountered: