anchor.diff:                                  raise <| Bad (getUsage argSpecs usageText)
                            f arg2
                            cursor := !cursor + 2
  -                    | FloatArg f ->
  +                    | Float f ->
                            let arg2 =
                               let arg2 = getSecondArg ()
                               try float arg2
  
positive.code: /// The spec value describes the action of the argument,
  /// and whether it expects a following parameter.
  type ArgType =
      | ClearArg of bool ref
      | FloatArg of (float -> unit)
      | IntArg of (int -> unit)
      | RestArg of (string -> unit)
      | SetArg of bool ref
      | StringArg of (string -> unit)
      | UnitArg of (unit -> unit)
  
      static member Clear r = ClearArg r
      static member Float r = FloatArg r
      static member Int r = IntArg r
      static member Rest r = RestArg r
      static member Set r = SetArg r
      static member String r = StringArg r
      static member Unit r = UnitArg r
  
  //
  type ArgInfo (name, action, help) =
      /// Return the name of the argument
      member x.Name = name
      /// Return the argument type and action of the argument
      member x.ArgType = action
      /// Return the usage help associated with the argument
      member x.HelpText = help
    
  //
  exception Bad of string
  //
  exception HelpText of string
  
  [<Sealed>]
  type ArgParser () =
      static let getUsage specs u =
          let sb = System.Text.StringBuilder 100
  
          let inline pstring (str : string) =
              sb.Append str |> ignore
          let inline pendline str =
              sb.AppendLine str |> ignore
  
          pendline u
          specs
          |> List.iter (fun (arg : ArgInfo) ->
              match arg.ArgType with
              | UnitArg _
              | SetArg _
              | ClearArg _ ->
                  //Printf.bprintfn sb "\t%s: %s" arg.Name arg.HelpText
                  pstring "\t"; pstring arg.Name; pstring ": "; pendline arg.HelpText
              | StringArg _ ->
                  pstring "\t"; pstring arg.Name; pstring " <string>: "; pendline arg.HelpText
              | IntArg _ ->
                  pstring "\t"; pstring arg.Name; pstring " <int>: "; pendline arg.HelpText
              | FloatArg _ ->
                  pstring "\t"; pstring arg.Name; pstring " <float>: "; pendline arg.HelpText
              | RestArg _ ->
                  pstring "\t"; pstring arg.Name; pstring " ...: "; pendline arg.HelpText
                  )
  
          pstring "\t"
          pstring "--help"
          pstring ": "
          pendline "display this list of options"
  
          pstring "\t"
          pstring "-help"
          pstring ": "
          pendline "display this list of options"
  
          sb.ToString ()
  
      /// Parse some of the arguments given by 'argv', starting at the given position
  
negative.code:         let specs =
              argSpecs
              |> List.map (fun (arg : ArgInfo) ->
                  arg.Name, arg.Type)
  
          while !cursor < nargs do
              let arg = argv.[!cursor]
              let rec findMatchingArg args =
                  match args with
                  | [] ->
                      // If any of the supplied arguments is a help switch, immediately print the help text and exit.
                      if arg = "-help" || arg = "--help" || arg = "/help" || arg = "/help" || arg = "/?" then
                          raise <| HelpText (getUsage argSpecs usageText)
  
                      // Note: for '/abc/def' does not count as an argument
                      // Note: '/abc' does
                      elif arg.Length > 0 && (arg.[0] = '-' || (arg.[0] = '/' && not (arg.Length > 1 && arg.[1..].Contains "/"))) then
                          let msg =
                              sprintf "Unrecognized argument: %s" arg
                              + System.Environment.NewLine
                              + getUsage argSpecs usageText
                          raise <| Bad msg
  
                      else
                         other arg
                         incr cursor
  