Skip to content

Ifdefs not respected #48

@TheAngryByrd

Description

@TheAngryByrd

Issue created from telplin-online

Implementation

namespace FsToolkit.ErrorHandling

open System.Threading.Tasks

[<RequireQualifiedAccess>]
module AsyncResult =


    let inline retn (value: 'ok) : Async<Result<'ok, 'error>> =
        Ok value
        |> async.Return

#if !FABLE_COMPILER

    let inline ofTask (aTask: Task<'ok>) : Async<Result<'ok, exn>> =

        async {
            let! res =
                aTask
                |> Async.AwaitTask
                |> Async.Catch

            return
                match res with
                | Choice1Of2 x -> Ok x
                | Choice2Of2 e -> Error e
        }

#endif

Signature

namespace FsToolkit.ErrorHandling

open System.Threading.Tasks

[<RequireQualifiedAccess>]
module AsyncResult =
    val inline retn: value: 'ok -> Async<Result<'ok, 'error>>
    val inline ofTask: aTask: Task<'ok> -> Async<Result<'ok, exn>>

Problem description

Then when building for fable:

.\src\FsToolkit.ErrorHandling\AsyncResult.fs(6,8): (6,19) error FSHARP: Module 'FsToolkit.ErrorHandling.AsyncResult' requires a value 'ofTask' (code 193)

Extra information

  • The proposed signature has problems.
  • I or my company would be willing to help fix this.

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