Skip to content

Instantly share code, notes, and snippets.

@kjnilsson
Created July 9, 2013 12:08
Show Gist options
  • Save kjnilsson/5956856 to your computer and use it in GitHub Desktop.
Save kjnilsson/5956856 to your computer and use it in GitHub Desktop.
Why can't I deconstruct the tuple that returns a function that returns and async and a function?
let test name =
fun (msg : obj) ->
async {
printfn name }, id
let f, f2 = Ipc.test "hello"
//gives:
//error FS0001: This expression was expected to have type
// 'a * 'b
//but here has type
// 'c -> Async<unit> * ('d -> 'd)
@ovatsus
Copy link

ovatsus commented Jul 9, 2013

The , has higher precedence that ->. Do this instead:

let test name =
    (fun (msg : obj) ->
        async {
            printfn name }), id

or this:

let test name =
    fun (msg : obj) ->
        async {
            printfn name }
    ,id

@kjnilsson
Copy link
Author

Thank you - forgot my parans! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment