Skip to content

Instantly share code, notes, and snippets.

@TheAngryByrd
Last active May 19, 2025 16:08
Show Gist options
  • Save TheAngryByrd/24e7862b3a5374e3ad3ae2256b940b7c to your computer and use it in GitHub Desktop.
Save TheAngryByrd/24e7862b3a5374e3ad3ae2256b940b7c to your computer and use it in GitHub Desktop.
F# Ignore Explicity
[<AutoOpen>]
module Ignore =
[<RequiresExplicitTypeArguments>]
let inline ignore<'a> (x: 'a) : unit = ignore<'a> x
type Async =
[<RequiresExplicitTypeArguments>]
static member inline Ignore<'a>(x: Async<'a>) : Async<unit> = FSharp.Control.Async.Ignore<'a> x
type Task =
[<RequiresExplicitTypeArguments>]
static member inline Ignore<'a>(x: Task<'a>) : Task<unit> =
x.ContinueWith(Func<Task<'a>, unit>(fun _ -> ()), TaskContinuationOptions.ExecuteSynchronously)
[<RequiresExplicitTypeArguments>]
static member inline IgnoreArg<'a>(x: Task<'a>) : System.Threading.Tasks.Task = x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment