-
Notifications
You must be signed in to change notification settings - Fork 48
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 elimNS
?
#143
Comments
Thanks for the suggestion.
All Top xs => NP (f -.-> K a) xs -> NS f xs -> a just works. However, even the type (SListIN h xs, HCollapse h, HAp h) => Prod h (f -.-> K a) xs -> h f xs -> CollapseTo h a works, which means it could then be used at all of these types All Top xs => NP (f -.-> K a) xs -> NS f xs -> a
All Top xs => NP (f -.-> K a) xs -> NP f xs -> [a]
All2 Top xss => POP (f -.-> K a) xss -> SOP f xss -> [a]
All2 Top xss => POP (f -.-> K a) xss -> POP f xss -> [[a]] Is In principle, I'm happy to add more functions, but naming is always hard, and if people end up defining their own function in the end anyway, despite them existing, I'm unsure how much is won by adding it. |
It's not, compare: iToK :: (a -> b) -> (I -.-> K b) a
mapIK :: (a -> b) -> I a -> K b c easy to define using *Data.SOP> :t fn . mapIK
fn . mapIK :: (a -> b) -> (-.->) I (K b) a EDIT: ( |
I dunno if this is too specific, but I found myself digging for this in the
sop-core
documentation, and eventually gave up and just wrote this myself:Along with
This lets me essentially pattern match on an
NS
:Maybe there is already a way to do this with
sop-core
?The text was updated successfully, but these errors were encountered: