Files
anki-static/AnkiStatic/ArgsCrate.fs
patrick 4070001e55
All checks were successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/all-checks-complete Pipeline was successful
Add app (#4)
Co-authored-by: Smaug123 <patrick+github@patrickstevens.co.uk>
Reviewed-on: #4
2023-09-08 23:31:01 +00:00

22 lines
625 B
Forth

namespace AnkiStatic.App
open System.Threading.Tasks
open Argu
type ArgsEvaluator<'ret> =
abstract Eval<'a, 'b when 'b :> IArgParserTemplate> :
(ParseResults<'b> -> Result<'a, ArguParseException list>) -> ('a -> Task<int>) -> 'ret
type ArgsCrate =
abstract Apply<'ret> : ArgsEvaluator<'ret> -> 'ret
[<RequireQualifiedAccess>]
module ArgsCrate =
let make<'a, 'b when 'b :> IArgParserTemplate>
(ofResult : ParseResults<'b> -> Result<'a, ArguParseException list>)
(run : 'a -> Task<int>)
=
{ new ArgsCrate with
member _.Apply e = e.Eval ofResult run
}