Skip to content

extend ComputationExpression builders with Map : m<'a> * ('a -> 'b) -> m<'b> #36

@baronfel

Description

@baronfel

Submitted by Georg Haaser on 1/31/2016 12:00:00 AM
8 votes on UserVoice prior to migration

In many scenarios computation expressions could be executed way more efficiently when having just a little more information. The typical use-case for that would be something like

    async {
        let! a = something
        return 2*a
    }

which currently gets translated to:

    async.Bind(something, fun a -> async.Return(2*a))

By monad laws (borrowed from haskell here) this must be equal to:

    async.Map(something, fun a -> 2*a)

In many scenarios the latter can be implemented with a lot less overhead, so in my opinion it would be profitable to allow users to provide this "shortcut".

Original UserVoice Submission
Archived Uservoice Comments

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions