fsprojects/FSharpx.Extras

bindM member constraint

glchapman opened this issue · 4 comments

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.

Thank you! That's an excellent point!

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

This is still an issue.

See commit 7139b80

Fixed in 2.4.0