question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why is there no generic 'bind' function?

See original GitHub issue

I know there is the >>= operator to pipe monads, but why is there no free-standing function named bind? So that instead of x >>= f one could write x |> bind x. This is already possible with map (<!> or |>> depending on operator order).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
cannorincommented, Sep 3, 2019

Personally I don’t need it but I don’t see any downside of adding it to F#+.

1reaction
wallymathieucommented, Nov 1, 2018

In the case when you’d browse the API using intellisense, it does makes sense to have bind defined. However, in parts of the library, Identity.fs#L18 they are defined differently than you’d expect from a bind (they are static members in order for this to work). You could expose the functions with f# signature in modules.

Read more comments on GitHub >

github_iconTop Results From Across the Web

typescript - How to bind a parameter to a generic function
If the parameters do depend on the generic type parameter, though, Parameters<T> will lose track of any type parameter: declare function ...
Read more >
Documentation - Generics
Without generics, we would either have to give the identity function a specific ... we'd get an array of numbers back out, as...
Read more >
How To Use Generics in TypeScript
One of the most common scenarios for using generics with functions is when you have some code that is not easily typed for...
Read more >
Generics - mypy 1.5.1 documentation
A variable cannot have a type variable in its type unless the type variable is bound in a containing generic class or function....
Read more >
Racket Generic Binding Forms
When using ~define to define a function, any generic binding must be define-allowable. (So the ~vs values-binding form is not allowed.).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found