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

Linear traversables #48

Closed
b-mehta opened this issue Aug 8, 2019 · 1 comment · Fixed by #50
Closed

Linear traversables #48

b-mehta opened this issue Aug 8, 2019 · 1 comment · Fixed by #50
Assignees

Comments

@b-mehta
Copy link
Contributor

b-mehta commented Aug 8, 2019

In the past, I'd edited traverse to have type signature

  traverse :: Data.Applicative f => (a ->. f b) -> t a ->. f (t b)

(and similar for sequence) - it now seems this was misguided, since it prevents Const, ((,) a), Either e from being Traversable. (And these last two instances are why Strong (,) () and Strong Either Void are superclasses of Wandering). Instead, the correct signature probably ought to be

  traverse :: Control.Applicative f => (a ->. f b) -> t a ->. f (t b)

This change should not prevent any instance from still working, but might need some definitions to be edited.

@b-mehta b-mehta self-assigned this Aug 8, 2019
@aspiwack
Copy link
Member

aspiwack commented Aug 8, 2019

Ah right, Data.Applicative if the traversable functor only has f and pure data in it. If there is anything else stored in it (like functions, or data of an arbitrary parameter), then you can only traverse it with a Data.Applicative if all that extra data is movable.

This is interesting. Probably switching to Control.Applicative and ropping the Data.Applicative variant altogether is the most reasonable for the moment.

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

Successfully merging a pull request may close this issue.

2 participants