Skip to content

Commit

Permalink
feat!: render wildcards as NoBody
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
brprice committed Jun 1, 2023
1 parent 3d22172 commit 2037646
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
4 changes: 2 additions & 2 deletions primer-service/test/outputs/OpenAPI/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,8 @@
"TEmptyHole",
"THole",
"TFun",
"TApp"
"TApp",
"PatternWildcard"
],
"type": "string"
},
Expand All @@ -428,7 +429,6 @@
"Letrec",
"PatternBind",
"PatternCon",
"PatternWildcard",
"TCon",
"TVar",
"TForall",
Expand Down
2 changes: 1 addition & 1 deletion primer/src/Primer/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion primer/src/Primer/API/NodeFlavor.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ data NodeFlavorTextBody
| Letrec
| PatternBind
| PatternCon
| PatternWildcard
| TCon
| TVar
| TForall
Expand Down Expand Up @@ -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)
10 changes: 1 addition & 9 deletions primer/test/outputs/APITree/Expr
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 2037646

Please sign in to comment.