diff --git a/dhall/dhall.cabal b/dhall/dhall.cabal index 6efeb5c72..54b8371b2 100644 --- a/dhall/dhall.cabal +++ b/dhall/dhall.cabal @@ -28,6 +28,7 @@ Extra-Source-Files: Prelude/Monoid tests/format/*.dhall tests/normalization/tutorial/combineTypes/*.dhall + tests/normalization/tutorial/prefer/*.dhall tests/normalization/tutorial/projection/*.dhall tests/normalization/tutorial/access/*.dhall tests/normalization/*.dhall diff --git a/dhall/src/Dhall/Parser/Expression.hs b/dhall/src/Dhall/Parser/Expression.hs index 8aa8b3bfa..31b6bbc2b 100644 --- a/dhall/src/Dhall/Parser/Expression.hs +++ b/dhall/src/Dhall/Parser/Expression.hs @@ -158,8 +158,8 @@ completeExpression embedded = completeExpression_ <|> Combine <$ _combine precedence2Operator = - Prefer <$ _prefer - <|> CombineTypes <$ _combineTypes + CombineTypes <$ _combineTypes + <|> Prefer <$ _prefer <|> NaturalTimes <$ _times <|> BoolNE <$ _notEqual diff --git a/dhall/tests/Normalization.hs b/dhall/tests/Normalization.hs index 87fd2b2ac..a509ac43a 100644 --- a/dhall/tests/Normalization.hs +++ b/dhall/tests/Normalization.hs @@ -40,6 +40,8 @@ tutorialExamples :: TestTree tutorialExamples = testGroup "Tutorial examples" [ shouldNormalize "⩓" "./tutorial/combineTypes/0" + , shouldNormalize "//\\\\" "./tutorial/combineTypes/1" + , shouldNormalize "//" "./tutorial/prefer/0" , shouldNormalize "projection" "./tutorial/projection/0" , shouldNormalize "access record" "./tutorial/access/0" , shouldNormalize "access union" "./tutorial/access/1" diff --git a/dhall/tests/normalization/tutorial/combineTypes/1A.dhall b/dhall/tests/normalization/tutorial/combineTypes/1A.dhall new file mode 100644 index 000000000..4c881a478 --- /dev/null +++ b/dhall/tests/normalization/tutorial/combineTypes/1A.dhall @@ -0,0 +1 @@ +{ foo : { bar : Text } } //\\ { foo : { baz : Bool }, qux : Integer } diff --git a/dhall/tests/normalization/tutorial/combineTypes/1B.dhall b/dhall/tests/normalization/tutorial/combineTypes/1B.dhall new file mode 100644 index 000000000..40b8c060b --- /dev/null +++ b/dhall/tests/normalization/tutorial/combineTypes/1B.dhall @@ -0,0 +1 @@ +{ foo : { bar : Text, baz : Bool }, qux : Integer } diff --git a/dhall/tests/normalization/tutorial/prefer/0A.dhall b/dhall/tests/normalization/tutorial/prefer/0A.dhall new file mode 100644 index 000000000..e078ccce6 --- /dev/null +++ b/dhall/tests/normalization/tutorial/prefer/0A.dhall @@ -0,0 +1 @@ +{ foo = 1, bar = "ABC" } // { baz = True } diff --git a/dhall/tests/normalization/tutorial/prefer/0B.dhall b/dhall/tests/normalization/tutorial/prefer/0B.dhall new file mode 100644 index 000000000..b98edeada --- /dev/null +++ b/dhall/tests/normalization/tutorial/prefer/0B.dhall @@ -0,0 +1 @@ +{ bar = "ABC", baz = True, foo = 1 }