Skip to content

Commit d561b77

Browse files
authored
Generalize grammar for certain annotation expressions (#2320)
… as standardized in dhall-lang/dhall-lang#1230
1 parent dc31e3c commit d561b77

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

dhall/src/Dhall/Parser/Expression.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -418,15 +418,15 @@ parsers embedded = Parsers{..}
418418
nonemptyWhitespace
419419
case (shallowDenote a, a0Info) of
420420
(ListLit Nothing [], _) -> do
421-
b <- applicationExpression
421+
b <- expression
422422

423423
return (ListLit (Just b) [])
424424
(Merge c d Nothing, NakedMergeOrSomeOrToMap) -> do
425-
b <- applicationExpression
425+
b <- expression
426426

427427
return (Merge c d (Just b))
428428
(ToMap c Nothing, NakedMergeOrSomeOrToMap) -> do
429-
b <- applicationExpression
429+
b <- expression
430430

431431
return (ToMap c (Just b))
432432
_ -> do

dhall/src/Dhall/Pretty/Internal.hs

+5-5
Original file line numberDiff line numberDiff line change
@@ -861,15 +861,15 @@ prettyPrinters characterSet =
861861
<> Pretty.indent 2 (prettyImportExpression_ b)
862862
<> Pretty.hardline
863863
<> colon <> space
864-
<> prettyApplicationExpression c
864+
<> prettyExpression c
865865
)
866866

867867
short = keyword "merge" <> space
868868
<> prettyImportExpression_ a
869869
<> " "
870870
<> prettyImportExpression_ b
871871
<> space <> colon <> space
872-
<> prettyApplicationExpression c
872+
<> prettyExpression c
873873
prettyAnnotatedExpression (ToMap a (Just b)) =
874874
Pretty.group (Pretty.flatAlt long short)
875875
where
@@ -880,13 +880,13 @@ prettyPrinters characterSet =
880880
<> Pretty.indent 2 (prettyImportExpression_ a)
881881
<> Pretty.hardline
882882
<> colon <> space
883-
<> prettyApplicationExpression b
883+
<> prettyExpression b
884884
)
885885

886886
short = keyword "toMap" <> space
887887
<> prettyImportExpression_ a
888888
<> space <> colon <> space
889-
<> prettyApplicationExpression b
889+
<> prettyExpression b
890890
prettyAnnotatedExpression a0@(Annot _ _) =
891891
enclose'
892892
""
@@ -906,7 +906,7 @@ prettyPrinters characterSet =
906906
prettyAnnotatedExpression (ListLit (Just a) b) =
907907
list (map prettyExpression (Data.Foldable.toList b))
908908
<> " : "
909-
<> prettyApplicationExpression a
909+
<> prettyExpression a
910910
prettyAnnotatedExpression a
911911
| Just doc <- preserveSource a =
912912
doc

0 commit comments

Comments
 (0)