Configuring `purty`


#1

vyorkin [5:01 PM]

@joneshf I’m trying out purty today :slightly_smiling_face: do you have some example of how a very simple .purty.dhall may look like? I’ve generated the initial config with purty --defaults > .purty.dhall with the following contents:

{ formatting =
    < Static = {=} | Dynamic : {} >
, output =
    < StdOut = {=} | InPlace : {} >
, verbosity =
    < NotVerbose = {=} | Verbose : {} >
}

but dunno where to go next :slightly_smiling_face:

joneshf [5:04 PM]
This seems like something I should write up.
So, there’s three things you can configure: formatting, output and verbosity.
Each of them happens to be a union of values you can choose from.
For formatting it can either be Static or Dynamic, for output it can either be StdOut or InPlace, for verbosity it can either be NotVerbose or Verbose.
If you’d like Dynamic, InPlace and NotVerbose, you could say something like:

{ formatting =
    < Dynamic = {=} | Static : {} >
, output =
    < InPlace = {=} | StdOut : {} >
, verbosity =
    < NotVerbose = {=} | Verbose : {} >
}

That’s pretty much it as far as configuring it goes.
The syntax might be a bit confusing though.
The { key1 = val1, key2 = val2, ... } is a record with keys keyN and values valN.
The < case = val | case1 : type1, ... > is a union with selected case case of value val and alternate cases caseN of types typeN.
The {=} is an empty record value.
The {} is an empty record type.
I think that’s all the syntax in that example.