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

Update Fn.concat to compose a function #2

Closed
wants to merge 1 commit into from
Closed

Update Fn.concat to compose a function #2

wants to merge 1 commit into from

Conversation

aabrook
Copy link

@aabrook aabrook commented Jul 16, 2017

Love the series and came on here to clone the spotify example. I saw there was an issue related and thought I'd try to help: #1

The Fn.concat is assuming that the function will return another Fn but it's usage (where fork is just calling the function) highlights that this is probably not intentional. This fix composes the functions together when concatenating.

@DrBoolean
Copy link
Owner

That variation is commonly known as Endo. The current one is more of the default behavior for functors - e.g. Maybe(m).concat(Maybe(n)) = Maybe(m.concat(n))

@aabrook
Copy link
Author

aabrook commented Jul 18, 2017

Ah k. Thanks! More readings required for me.

@aabrook aabrook closed this Jul 18, 2017
@DrBoolean
Copy link
Owner

Nah! Totally got an intuition and nailed the endo instance. It's hard without any types to show contraints

@aabrook aabrook deleted the fix/fn-concat branch August 1, 2017 00:08
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 this pull request may close these issues.

2 participants