From 2b7ea599ae09c077bd8bda82cfb3c2601925e300 Mon Sep 17 00:00:00 2001 From: Gabriel Gonzalez Date: Fri, 31 Jan 2020 07:01:54 -0800 Subject: [PATCH] Reformat code --- README.md | 48 +++++++++++------------ examples/small.dhall | 2 +- examples/unvalidated.dhall | 2 +- examples/validated.dhall | 63 ++++++++++++++----------------- render/AUTOPICKUP_EXCEPTION.dhall | 2 +- render/Config.dhall | 12 ++++-- render/Disclosure.dhall | 8 ++-- render/Hilite.dhall | 6 +-- render/HiliteStatus.dhall | 10 ++--- render/MenuColor.dhall | 4 +- render/MsgType.dhall | 2 +- render/ParanoidConfirmation.dhall | 6 +-- render/Scores.dhall | 12 +++--- 13 files changed, 86 insertions(+), 91 deletions(-) diff --git a/README.md b/README.md index b4002e2..4a30de7 100644 --- a/README.md +++ b/README.md @@ -22,34 +22,28 @@ let types = ./types.dhall let toNetHack = ./toNetHack.dhall let config = - types.Config::{ - , name = Some "Kaeru" - , role = Some { enable = True, value = types.Role.wizard } - , align = Some { enable = True, value = types.Alignment.chaotic } - , race = Some { enable = True, value = types.Race.elf } - , gender = Some types.Gender.female - , pettype = Some types.PetType.cat - , catname = Some "Imoen" - , fruit = Some "apple pie" - , autopickup = Some False - , disclose = - let secret = Some { default = False, prompt = False } - - in Some - { attributes = - secret - , conduct = - secret - , dungeon_overview = - secret - , inventory = - secret - , monsters_genocided = - secret - , monsters_killed = - secret + types.Config::{ + , name = Some "Kaeru" + , role = Some { enable = True, value = types.Role.wizard } + , align = Some { enable = True, value = types.Alignment.chaotic } + , race = Some { enable = True, value = types.Race.elf } + , gender = Some types.Gender.female + , pettype = Some types.PetType.cat + , catname = Some "Imoen" + , fruit = Some "apple pie" + , autopickup = Some False + , disclose = + let secret = Some { default = False, prompt = False } + + in Some + { attributes = secret + , conduct = secret + , dungeon_overview = secret + , inventory = secret + , monsters_genocided = secret + , monsters_killed = secret } - } + } in toNetHack config ``` diff --git a/examples/small.dhall b/examples/small.dhall index 974de40..8e8902e 100644 --- a/examples/small.dhall +++ b/examples/small.dhall @@ -12,7 +12,7 @@ in types.Config::{ , autopickup = Some False , disclose = let secret = Some { default = False, prompt = False } - + in Some { attributes = secret , conduct = secret diff --git a/examples/unvalidated.dhall b/examples/unvalidated.dhall index 6b161a3..4e7fc87 100644 --- a/examples/unvalidated.dhall +++ b/examples/unvalidated.dhall @@ -5,7 +5,7 @@ ./validated.dhall ⫽ { rlecomp = Some False , SOUND = - [ { regex = "This door is locked", filename = "lock.wav", volume = 100 } ] + [ { regex = "This door is locked", filename = "lock.wav", volume = 100 } ] , SOUNDDIR = Some "C:\\foo" , zerocomp = Some False } diff --git a/examples/validated.dhall b/examples/validated.dhall index f722331..13f9e1e 100644 --- a/examples/validated.dhall +++ b/examples/validated.dhall @@ -7,22 +7,20 @@ let types = ../types.dhall in types.Config::{ , AUTOCOMPLETE = - [ { enable = True, value = "zap" } - , { enable = False, value = "annotate" } - ] + [ { enable = True, value = "zap" } + , { enable = False, value = "annotate" } + ] , acoustics = Some True , align = Some { enable = True, value = types.Alignment.chaotic } , autodescribe = Some False , autodig = Some False , AUTOPICKUP_EXCEPTION = - [ { pickup = False, name = "chest" } - , { pickup = True, name = "dagger" } - ] + [ { pickup = False, name = "chest" }, { pickup = True, name = "dagger" } ] , BIND = - [ { keybinding = "!", command = "loot" } - , { keybinding = "^v", command = "untrap" } - , { keybinding = "M-x", command = "terrain" } - ] + [ { keybinding = "!", command = "loot" } + , { keybinding = "^v", command = "untrap" } + , { keybinding = "M-x", command = "terrain" } + ] , catname = Some "Mirri" , checkpoint = Some True , checkspace = Some True @@ -30,16 +28,14 @@ in types.Config::{ , cmdassist = Some True , confirm = Some True , dark_room = Some False - , disclose = - Some - types.Disclose::{ - , inventory = Some { prompt = True, default = True } - , attributes = Some { prompt = True, default = False } - , monsters_killed = Some { prompt = False, default = True } - , monsters_genocided = Some { prompt = False, default = False } - , conduct = Some { prompt = False, default = False } - , dungeon_overview = Some { prompt = False, default = False } - } + , disclose = Some types.Disclose::{ + , inventory = Some { prompt = True, default = True } + , attributes = Some { prompt = True, default = False } + , monsters_killed = Some { prompt = False, default = True } + , monsters_genocided = Some { prompt = False, default = False } + , conduct = Some { prompt = False, default = False } + , dungeon_overview = Some { prompt = False, default = False } + } , dogname = Some "Cujo" , extmenu = Some False , fixinv = Some True @@ -50,15 +46,14 @@ in types.Config::{ , help = Some True , hilite_pet = Some False , hilite_pile = Some False - , hilite_status = - types.HiliteStatus::{ - , gold = - [ { color = types.Color.yellow - , trigger = Some types.Numeric.always - , attributes = None types.Attributes.Type - } - ] - } + , hilite_status = types.HiliteStatus::{ + , gold = + [ { color = types.Color.yellow + , trigger = Some types.Numeric.always + , attributes = None types.Attributes.Type + } + ] + } , hitpointbar = Some True , horsename = Some "Erhir" , ignintr = Some False @@ -69,11 +64,11 @@ in types.Config::{ , mail = Some True , mention_walls = Some False , menucolors = - [ { regex = "blessed" - , color = Some types.Color.cyan - , attributes = types.Attributes::{ bold = Some True } - } - ] + [ { regex = "blessed" + , color = Some types.Color.cyan + , attributes = types.Attributes::{ bold = Some True } + } + ] , menustyle = Some types.MenuStyle.traditional , menu_deselect_all = Some "-" , menu_deselect_page = Some "\\" diff --git a/render/AUTOPICKUP_EXCEPTION.dhall b/render/AUTOPICKUP_EXCEPTION.dhall index cb39fca..163d2a3 100644 --- a/render/AUTOPICKUP_EXCEPTION.dhall +++ b/render/AUTOPICKUP_EXCEPTION.dhall @@ -2,5 +2,5 @@ let types = ../types.dhall in λ(x : types.AUTOPICKUP_EXCEPTION) → let prefix = if x.pickup then "<" else ">" - + in "AUTOPICKUP_EXCEPTION=\"${prefix}${x.name}\"" diff --git a/render/Config.dhall b/render/Config.dhall index ee349e5..58f4144 100644 --- a/render/Config.dhall +++ b/render/Config.dhall @@ -49,7 +49,13 @@ let renderOptionalNatural = renderNamedOptional Natural Natural/show let renderList = λ(a : Type) → λ(f : a → Text) - → Prelude.Text.concatMap a (λ(x : a) → "${f x}\n") + → Prelude.Text.concatMap + a + ( λ(x : a) + → '' + ${f x} + '' + ) let renderOptionalEnabled = λ(a : Type) @@ -84,9 +90,9 @@ let renderDisclose = let renderMenuColors = λ(x : List types.MenuColor) → if Prelude.List.null types.MenuColor x - + then "" - + else '' OPTIONS=menucolors ${renderList types.MenuColor ./MenuColor.dhall x}'' diff --git a/render/Disclosure.dhall b/render/Disclosure.dhall index f8baa39..2c7555f 100644 --- a/render/Disclosure.dhall +++ b/render/Disclosure.dhall @@ -2,11 +2,11 @@ let types = ../types.dhall in λ(x : types.Disclosure) → if x.prompt - + then if x.default then "y" else "n" - + else if x.default - + then "+" - + else "-" diff --git a/render/Hilite.dhall b/render/Hilite.dhall index 7f07e00..f601e7e 100644 --- a/render/Hilite.dhall +++ b/render/Hilite.dhall @@ -10,7 +10,7 @@ in λ(a : Type) Text (λ(trigger : a) → "/${renderTrigger trigger}") "" - + let attributes = Optional/fold types.Attributes.Type @@ -18,7 +18,7 @@ in λ(a : Type) Text (λ(a : types.Attributes.Type) → "&${./Attributes.dhall a}") "" - + let color = "/${./Color.dhall hilite.color}" - + in "${trigger}${color}${attributes}" diff --git a/render/HiliteStatus.dhall b/render/HiliteStatus.dhall index c624c91..f122507 100644 --- a/render/HiliteStatus.dhall +++ b/render/HiliteStatus.dhall @@ -16,16 +16,16 @@ in λ(x : types.HiliteStatus.Type) renderTrigger h}" ) - + let renderTextualHilites = renderHilites types.Textual ./Textual.dhall - + let renderNumericHilites = renderHilites types.Numeric ./Numeric.dhall - + let renderPercentHilites = renderHilites types.Percent ./Percent.dhall - + let renderConditionHilites = renderHilites types.Condition ./Condition.dhall - + in renderTextualHilites "title" x.title ++ renderNumericHilites "strength" x.strength ++ renderNumericHilites "dexterity" x.dexterity diff --git a/render/MenuColor.dhall b/render/MenuColor.dhall index 8f57cde..63982f6 100644 --- a/render/MenuColor.dhall +++ b/render/MenuColor.dhall @@ -2,7 +2,7 @@ let types = ../types.dhall in λ(x : types.MenuColor) → let attributes = ./Attributes.dhall x.attributes - + let suffix = Optional/fold types.Color @@ -10,5 +10,5 @@ in λ(x : types.MenuColor) Text (λ(c : types.Color) → "${./Color.dhall c}&${attributes}") attributes - + in "MENUCOLOR=\"${x.regex}\"=${suffix}" diff --git a/render/MsgType.dhall b/render/MsgType.dhall index b7089cc..ac8c33a 100644 --- a/render/MsgType.dhall +++ b/render/MsgType.dhall @@ -9,5 +9,5 @@ in λ(x : types.MsgType) , show = λ(t : Text) → "show \"${t}\"" } x - + in "MSGTYPE=${value}" diff --git a/render/ParanoidConfirmation.dhall b/render/ParanoidConfirmation.dhall index 9cb40bc..a83805e 100644 --- a/render/ParanoidConfirmation.dhall +++ b/render/ParanoidConfirmation.dhall @@ -24,11 +24,11 @@ in λ(x : types.ParanoidConfirmation.Type) # renderConfirmation "Were-change" x.Were-change # renderConfirmation "Remove" x.Remove # renderConfirmation "all" x.all - + in if Prelude.List.null Text confirmations - + then "" - + else '' OPTIONS=paranoid_confirmation:${Prelude.Text.concatSep " " diff --git a/render/Scores.dhall b/render/Scores.dhall index 2636dce..3111431 100644 --- a/render/Scores.dhall +++ b/render/Scores.dhall @@ -10,7 +10,7 @@ in λ(x : types.Scores.Type) (List Text) (λ(b : Bool) → [ "${./Bool.dhall b}o" ]) ([] : List Text) - + let around = Optional/fold Natural @@ -18,7 +18,7 @@ in λ(x : types.Scores.Type) (List Text) (λ(n : Natural) → [ "${Natural/show n}a" ]) ([] : List Text) - + let top = Optional/fold Natural @@ -26,13 +26,13 @@ in λ(x : types.Scores.Type) (List Text) (λ(n : Natural) → [ "${Natural/show n}t" ]) ([] : List Text) - + let scores = own # around # top - + in if Prelude.List.null Text scores - + then "" - + else '' OPTIONS=scores:${Prelude.Text.concatSep " " scores} ''