Fix dhall decode bug (#859)

... as caught by @singpolyma

`Dhall.Binary.unApply` was failing to uncurry functions due to the presence of
`Note` constructors.  This caused `dhall encode` to produce different
results from `dhall hash` since the latter was normalizing the expression
(and therefore removing `Note` constructors) whereas the former was not.
This commit is contained in:
Gabriel Gonzalez 2019-03-24 13:18:21 -07:00 committed by GitHub
parent c900081a34
commit 4c9dc60b20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

@ -1 +1 @@
Subproject commit 8b9edd288071566eab4d94f643709e1d9ef9e574
Subproject commit b1c9e532e66dc1a5d60ddc9a84139212fb1f44a1

View File

@ -111,13 +111,16 @@ renderStandardVersion V_5_0_0 = "5.0.0"
the list of arguments
-}
unApply :: Expr s a -> (Expr s a, [Expr s a])
unApply e = (baseFunction, diffArguments [])
unApply e = (baseFunction, diffArguments [])
where
~(baseFunction, diffArguments) = go e
~(baseFunction, diffArguments) = go e
go (App f a) = (baseFunction, diffArguments . (a :))
where
~(baseFunction, diffArguments) = go f
go (Note _ e) = go e
go baseFunction = (baseFunction, id)
-- | Encode a Dhall expression to a CBOR `Term`