From 69d75cc73bd4fcc18ebbe73e081c08d0de7c45b2 Mon Sep 17 00:00:00 2001 From: Ben Price Date: Tue, 30 May 2023 16:08:10 +0100 Subject: [PATCH] feat!: render wildcards as NoBody Previously we emitted it as a TextBody with contents "_". This is a rendering decision that should be left to a frontend. BREAKING CHANGE: this changes the OpenAPI Signed-off-by: Ben Price --- primer/src/Primer/API.hs | 2 +- primer/src/Primer/API/NodeFlavor.hs | 2 +- primer/test/outputs/APITree/Expr | 10 +--------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/primer/src/Primer/API.hs b/primer/src/Primer/API.hs index b4c0e7301..fc26fc769 100644 --- a/primer/src/Primer/API.hs +++ b/primer/src/Primer/API.hs @@ -890,7 +890,7 @@ viewTreeExpr e0 = case e0 of BoxBody . RecordPair Flavor.Pattern $ ( Tree { nodeId = patternRootId - , body = TextBody $ RecordPair Flavor.PatternWildcard (Name Nothing "_") + , body = NoBody Flavor.PatternWildcard , childTrees = [] , rightChild = Nothing } diff --git a/primer/src/Primer/API/NodeFlavor.hs b/primer/src/Primer/API/NodeFlavor.hs index 69bffcbcc..edabd9e54 100644 --- a/primer/src/Primer/API/NodeFlavor.hs +++ b/primer/src/Primer/API/NodeFlavor.hs @@ -28,7 +28,6 @@ data NodeFlavorTextBody | Letrec | PatternBind | PatternCon - | PatternWildcard | TCon | TVar | TForall @@ -64,6 +63,7 @@ data NodeFlavorNoBody | THole | TFun | TApp + | PatternWildcard deriving stock (Show, Read, Eq, Generic, Enum, Bounded) deriving (ToJSON, FromJSON) via PrimerJSON NodeFlavorNoBody deriving anyclass (NFData) diff --git a/primer/test/outputs/APITree/Expr b/primer/test/outputs/APITree/Expr index bb653709e..ff643cb5a 100644 --- a/primer/test/outputs/APITree/Expr +++ b/primer/test/outputs/APITree/Expr @@ -494,15 +494,7 @@ Tree { fst = Pattern , snd = Tree { nodeId = "39PwildB" - , body = TextBody - ( RecordPair - { fst = PatternWildcard - , snd = Name - { qualifiedModule = Nothing - , baseName = "_" - } - } - ) + , body = NoBody PatternWildcard , childTrees = [] , rightChild = Nothing }