Documentation

Common.Flags

inductive Target :

Which backend the compiler is asked to target, per the -t/--target flag.

Instances For
    @[implicit_reducible]
    Equations
    Equations
    Instances For
      @[implicit_reducible]
      Equations
      inductive Feature :

      A -f<name> feature toggle.

      This enumeration is the only place a toggle's spelling is written: the CLI validates -f against Feature.list, and every consumer reads one through the accessor named after it (FlagsEnv.colored, FlagsEnv.progress), never through a string literal. Adding a toggle and registering it are therefore the same edit, which a hand-maintained knownFeatures array could not guarantee.

      • noColor : Feature

        -fno-color: no ANSI styling in diagnostics or progress output.

      • noProgress : Feature

        -fno-progress: no animated spinner, just plain lines.

      Instances For
        @[implicit_reducible]
        Equations
        Equations
        Instances For
          @[implicit_reducible]
          Equations

          The -f<name> spelling of a toggle.

          Equations
          Instances For

            What the toggle does, as fugue help -f lists it. Here rather than in Fugue.lean for the same reason the spelling is: a toggle added without a description could not be listed.

            Equations
            Instances For

              Every toggle, in the order -f's help text lists them.

              Equations
              Instances For
                @[implicit_reducible]
                Equations
                structure FlagsEnv :

                The fully-parsed CLI flag surface, computed once by the driver from Cli.Parsed and threaded to every pass via MonadReaderOf FlagsEnv m, rather than an opaque getFlag action: flags aren't uniformly Option String (boolean -f/-W flags vs. valued -d<name>=<value> options vs. -o/-t/-I's own typed values), and the project's Std.Do.WP-based proofs need a transparent Reader effect to reason about, not an opaque one.

                Instances For

                  Is -d<name> (with or without a value) present?

                  Equations
                  Instances For

                    The value attached to -d<name>=<value>, if any (also none if -d<name> was given without a value).

                    Equations
                    Instances For

                      Is f (with or without a value) present? The non-monadic form: the CLI and the driver hold a FlagsEnv directly rather than reading one out of a monad.

                      Equations
                      Instances For

                        Is ANSI styling on for this compile's output? -fno-color turns it off.

                        Equations
                        Instances For

                          Is the animated progress spinner on? -fno-progress turns it off.

                          Equations
                          Instances For

                            Is f (with or without a value) present?

                            Equations
                            Instances For

                              The value attached to -X<name>=<value>, if any (also none for a valueless -X<name>).

                              Equations
                              Instances For

                                Is -X<name> (with or without a value) present? For a valueless option like go-cond, this is the whole check — getTargetOption would answer none either way, present or absent.

                                Equations
                                Instances For

                                  Monadic form of hasTargetOption.

                                  Equations
                                  Instances For

                                    The value attached to -f<name>=<value>, if any.

                                    Equations
                                    Instances For

                                      Is warning name enabled? Defaults to true (warnings are on unless -Wno-<name> was given).

                                      Equations
                                      Instances For

                                        There is deliberately no MonadReaderOf FlagsEnv IO instance backed by a global IO.Ref: a FlagsEnv belongs to one compile, not to the process. Driver/Pipeline.lean's runPipeline takes one and supplies it as a real ReaderT layer, so two compiles running concurrently in the same process (the regression runner does exactly this) cannot see each other's flags. The CLI builds its FlagsEnv once from Cli.Parsed and hands it over the same way.

                                        Where -d dump-* debugging artifacts go, and how they get written. Shared because both the driver (Driver/Modules.lean, which dumps the per-module stages it runs — lex, parse, desugar, typecheck) and the pipeline (Driver/Pipeline.lean, which dumps the stages that run past the driver — computable, guarded, network, go) write them, and the two must agree on the directory.

                                        Default value of -ddump-dir:<path>.

                                        Equations
                                        Instances For

                                          The directory -d dump-* artifacts are written to: -ddump-dir:<path> if given, defaultDumpDir otherwise. Named like the getDebugOption/getFeatureFlag accessors above, which it is one of.

                                          Equations
                                          Instances For
                                            def dumpToFile {m : TypeType} [Monad m] [MonadLiftT IO m] (content : String) (dir : System.FilePath) (name : String) :

                                            Write a -d dump-* debugging artifact to dir/name, creating dir if needed.

                                            Equations
                                            Instances For
                                              def dumpStage {m : TypeType} [Monad m] [MonadReaderOf FlagsEnv m] [MonadLiftT IO m] {α : Type} [Repr α] (stage : Stage) (name : String) (value : α) :

                                              Write value to <dump-dir>/<name>-<stage> if -d dump-<stage> was given; do nothing otherwise.

                                              The one dump point. Every -d dump-* artifact goes through it — the per-module stages the driver runs (Driver/Modules.lean) and the stages the pipeline runs past it (Driver/Pipeline.lean) — so a stage's flag name, the file it writes and its Stage.dumpable entry cannot disagree, and Fugue.lean derives the whole -d allowlist from Stage.list.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For