From 4b80c138751ed9b8e5b0bdd72b4afc82b890b223 Mon Sep 17 00:00:00 2001 From: Evan Czaplicki Date: Mon, 10 Feb 2014 23:21:22 +0100 Subject: [PATCH] Fix style of error message for undefined variables --- compiler/Transform/Canonicalize.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/Transform/Canonicalize.hs b/compiler/Transform/Canonicalize.hs index 0d6d045..a7ae037 100644 --- a/compiler/Transform/Canonicalize.hs +++ b/compiler/Transform/Canonicalize.hs @@ -12,6 +12,7 @@ import qualified Data.Traversable as T import SourceSyntax.Annotation as A import SourceSyntax.Expression import SourceSyntax.Module +import SourceSyntax.PrettyPrint (pretty) import qualified SourceSyntax.Pattern as P import qualified SourceSyntax.Type as Type import qualified SourceSyntax.Variable as Var @@ -114,7 +115,10 @@ replace variable env v = rename :: Env -> Expr -> Either [Doc] Expr rename env (A ann expr) = let rnm = rename env - throw err = Left [ P.text $ "Error " ++ show ann ++ "\n" ++ err ] + throw err = Left [ P.vcat [ P.text "Error" <+> pretty ann <> P.colon + , P.text err + ] + ] format = Either.either throw return renameType' environ = renameType (format . replace "variable" environ) in