Skip to content

CCOption.bind and CCParse.bind have inconsistent parameter orders; should be unified?Β #466

@torch-and-blanket

Description

@torch-and-blanket

Depending on this project's attitude toward breaking changes, it may be worth changing CCOption.bind : 'a option -> ('a -> 'b option) -> 'b option to align with the current type of CCParse.bind : ('a -> 'b CCParse.t) -> 'a CCParse.t -> 'b CCParse.t. I suggest this, rather than vice versa, to facilitate patterns like return x |> bind f |> bind g, following the general principle that a function's final argument should be the argument to which that function is least likely to be "partially" applied.

Making the types of all bind functions consistent throughout the library will make it easier to write functors that expect monads as well and help keep interfaces to CC modules predictable. As far as I can tell, these two are the only instances of bind throughout containers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions