Closed guibou closed 2 years ago
The problem with lambda is fixed. I observed that our support for pattern matching is rather limited in lambda.
I need to fix the build with different GHC, and we'll launch this in production.
Works with the different version of GHC we are supporting. I forgot to handle the width
and precision
fields, so let's fix that.
width
and precision
fields are now correctly handled.
Close #102.
The following quote, where
name
is not defined:was previously failing with just a simple error message,
variable not found: name
and the error context was a span covering the complete quote.Now it gives a detailled location for the missing variable:
Code is not perfect and could be cleaned / refactored, but as long as test are passing, we'll clean later.
The difficult part in this MR is that code which introduces new names, such as
[fmt|hello {(\x -> x) name}|]
will fail becausex
will be considered as an undefined variable.I'm sure nobody is using PyF this way (with case and lambda in the formatting expression), but well, it should not fail.
Hence I had to introduce a mecanism which detects which variables are new binding and which are free variables.
TODO: do also the check in
width
andprecision
field, which can also contain haskell expression.