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

fix collectOf on Grate Module #63

Merged
merged 4 commits into from
Dec 17, 2020
Merged

Conversation

syaiful6
Copy link
Contributor

This close #62.

test/Main.purs Outdated
collectOfTest :: forall f a b. Distributive f => (a -> f b) -> Tuple a a -> f (Tuple b b)
collectOfTest = collectOf aGrateExample
collectOfTest :: forall f g a b. Functor f => Distributive g => (a -> g b) -> f a -> g (f b)
collectOfTest = collectOf cotraversed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does collectOf aGrateExample still type check?

Copy link
Contributor Author

@syaiful6 syaiful6 May 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paf31 hmm, no, it have different type, if we apply collectOf to aGrateExample, it will have this type instead:

collectOfTest :: forall f a b. Functor f => (a -> Tuple b b) -> f a -> Tuple (f b) (f b)
collectOfTest = collectOf aGrateExample

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you want me to add tests for it?

@syaiful6
Copy link
Contributor Author

syaiful6 commented May 25, 2017

@paf31 I add test example for collectOf and revert the definition, so it use aGrateExample. This way everyone can see how this functions can be used, if you run that it will output: Tuple [8,10] [16,25]. I think it useful, as we can see it look like we have Distributive instance for Tuple (which in reality it doesn't). It was surprised me, look like there are a connection between Distributive and Closed profunctor somehow.

@thomashoneyman thomashoneyman changed the base branch from master to main October 9, 2020 23:08
@thomashoneyman thomashoneyman added the purs-0.14 A reminder to address this issue or merge this PR before we release PureScript v0.14.0 label Dec 10, 2020
@thomashoneyman thomashoneyman merged commit e3beeb2 into purescript-contrib:main Dec 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
purs-0.14 A reminder to address this issue or merge this PR before we release PureScript v0.14.0
Development

Successfully merging this pull request may close these issues.

[Grate Module] Should collectOf be defined as
3 participants