fsprojects / FSharpx.Extras

Functional programming and other utilities from the original "fsharpx" project
https://fsprojects.github.io/FSharpx.Extras/
The Unlicense
683 stars 146 forks source link

bindM member constraint #314

Closed glchapman closed 4 years ago

glchapman commented 9 years ago

in ComputationExpressions/Monad.fs, bindM is defined as:

    let inline bindM builder m f = (^M: (member Bind: 'd -> ('e -> 'c) -> 'c) (builder, m, f))

this is not strictly correct since Bind does not take curried arguments. It works anyway because the current fsharp compiler changes the constraint:

> let inline bindM builder m f = (^M: (member Bind: 'd -> ('e -> 'c) -> 'c) (builder, m, f));;

val inline bindM :
  builder: ^M -> m:'d -> f:('e -> 'c) -> 'c
    when  ^M : (member Bind :  ^M * 'd * ('e -> 'c) -> 'c)

When fsi echoes back the type of bindM, the member constraint has tupled arguments. You might want to fix this anyway in case the compiler ever changes.

panesofglass commented 9 years ago

Thank you! That's an excellent point!

gdziadkiewicz commented 4 years ago

https://github.com/fsprojects/FSharpx.Extras/blob/db96e064d67b8208b255ae0444330015824d948a/src/FSharpx.Extras/ComputationExpressions/Operators.fs#L8

This is still an issue.

panesofglass commented 4 years ago

See commit 7139b80

gdziadkiewicz commented 4 years ago

Fixed in 2.4.0