# fsharp-arguments Some helpers in [Myriad](https://github.com/MoiraeSoftware/myriad/) which might be useful for someone writing an argument parser. ## `RemoveOptions` Takes a record like this: ```fsharp type Foo = { A : int option B : string C : float list } ``` and stamps out a record like this: ```fsharp [] module Foo = type Short = { A : int B : string C : float list } ``` (This is a proof of concept. It would be better to somehow disambiguate the module name.) ## `JsonParse` Takes records like this: ```fsharp [] type InnerType = { [] Thing : string } /// My whatnot [] type JsonRecordType = { /// A thing! A : int /// Another thing! B : string [] C : int list D : InnerType } ``` and stamps out parsing methods like this: ```fsharp /// Module containing JSON parsing methods for the InnerType type [] [] module InnerType = /// Parse from a JSON node. let jsonParse (node: System.Text.Json.Nodes.JsonNode) : InnerType = let Thing = node.["something"].AsValue().GetValue() { Thing = Thing } namespace UsePlugin /// Module containing JSON parsing methods for the JsonRecordType type [] [] module JsonRecordType = /// Parse from a JSON node. let jsonParse (node: System.Text.Json.Nodes.JsonNode) : JsonRecordType = let D = InnerType.jsonParse node.["d"] let C = node.["hi"].AsArray() |> Seq.map (fun elt -> elt.GetValue()) |> List.ofSeq let B = node.["b"].AsValue().GetValue() let A = node.["a"].AsValue().GetValue() { A = A; B = B; C = C; D = D } ```