@@ -51,7 +51,9 @@ import qualified Text.Parsec as P
5151--
5252data SimpleErrorMessage
5353 = ErrorParsingExterns P.ParseError
54+ | ErrorParsingFFIModule FilePath
5455 | ErrorParsingPrelude P.ParseError
56+ | ErrorParsingModule P.ParseError
5557 | InvalidExternsFile FilePath
5658 | CannotGetFileInfo FilePath
5759 | CannotReadFile FilePath
@@ -121,7 +123,7 @@ data SimpleErrorMessage
121123-- |
122124-- Wrapper of simpler errors
123125--
124−data ErrorMessage
126+data ErrorMessage
125127 = NotYetDefined [Ident] ErrorMessage
126128 | ErrorUnifyingTypes Type Type ErrorMessage
127129 | ErrorInExpression Expr ErrorMessage
@@ -142,10 +144,10 @@ data ErrorMessage
142144 | PositionedError SourceSpan ErrorMessage
143145 | SimpleErrorWrapper SimpleErrorMessage
144146 deriving (Show)
145−
147+
146148instance UnificationError Type ErrorMessage where
147149 occursCheckFailed t = SimpleErrorWrapper $ InfiniteType t
148−
150+
149151instance UnificationError Kind ErrorMessage where
150152 occursCheckFailed k = SimpleErrorWrapper $ InfiniteKind k
151153
@@ -155,7 +157,9 @@ instance UnificationError Kind ErrorMessage where
155157errorCode :: ErrorMessage -> String
156158errorCode em = case unwrapErrorMessage em of
157159 (ErrorParsingExterns _) -> "ErrorParsingExterns"
160+ (ErrorParsingFFIModule _) -> "ErrorParsingFFIModule"
158161 (ErrorParsingPrelude _) -> "ErrorParsingPrelude"
162+ (ErrorParsingModule _) -> "ErrorParsingModule"
159163 (InvalidExternsFile _) -> "InvalidExternsFile"
160164 (CannotGetFileInfo _) -> "CannotGetFileInfo"
161165 (CannotReadFile _) -> "CannotReadFile"
@@ -224,12 +228,12 @@ errorCode em = case unwrapErrorMessage em of
224228-- |
225229-- A stack trace for an error
226230--
227−newtype MultipleErrors = MultipleErrors
231+newtype MultipleErrors = MultipleErrors
228232 { runMultipleErrors :: [ErrorMessage] } deriving (Show, Monoid)
229−
233+
230234instance UnificationError Type MultipleErrors where
231235 occursCheckFailed = occursCheckFailed
232−
236+
233237instance UnificationError Kind MultipleErrors where
234238 occursCheckFailed = occursCheckFailed
235239
@@ -288,7 +292,7 @@ unwrapErrorMessage em = case em of
288292 (SimpleErrorWrapper sem) -> sem
289293
290294replaceUnknowns :: Type -> State UnknownMap Type
291−replaceUnknowns = everywhereOnTypesM replaceTypes
295+replaceUnknowns = everywhereOnTypesM replaceTypes
292296 where
293297 lookupTable :: (LabelType, Unknown) -> UnknownMap -> (Unknown, UnknownMap)
294298 lookupTable x m = case M.lookup x m of
@@ -348,7 +352,7 @@ prettyPrintSingleError full e = prettyPrintErrorMessage <$> onTypesInErrorMessag
348352 where
349353 wikiUri :: String
350354 wikiUri = "https://github.com/purescript/purescript/wiki/Error-Code-" ++ errorCode e
351−
355+
352356 go :: ErrorMessage -> Box.Box
353357 goSimple (CannotGetFileInfo path) = paras [ line "Unable to read file info: "
354358 , indent . line $ path
@@ -362,6 +366,9 @@ prettyPrintSingleError full e = prettyPrintErrorMessage <$> onTypesInErrorMessag
362366 goSimple (ErrorParsingExterns err) = paras [ line "Error parsing externs files: "
363367 , indent . line . show $ err
364368 ]
369+ goSimple (ErrorParsingFFIModule path) = paras [ line "Unable to parse module from FFI file: "
370+ , indent . line $ path
371+ ]
365372 goSimple (ErrorParsingPrelude err) = paras [ line "Error parsing prelude: "
366373 , indent . line . show $ err
367374 ]
@@ -409,7 +416,7 @@ prettyPrintSingleError full e = prettyPrintErrorMessage <$> onTypesInErrorMessag
409416 goSimple (PartiallyAppliedSynonym name) = line $ "Partially applied type synonym " ++ show name
410417 goSimple (EscapedSkolem binding) = paras $ [ line "Rigid/skolem type variable has escaped." ]
411418 <> foldMap (\expr -> [ line "Relevant expression: "
412− , indent $ line $ prettyPrintValue expr
419+ , indent $ line $ prettyPrintValue expr
413420 ]) binding
414421 goSimple (TypesDoNotUnify t1 t2) = paras [ line "Cannot unify type"
415422 , indent $ line $ prettyPrintType t1
@@ -432,7 +439,7 @@ prettyPrintSingleError full e = prettyPrintErrorMessage <$> onTypesInErrorMessag
432439 goSimple (NoInstanceFound nm ts) = line $ "No instance found for " ++ show nm ++ " " ++ unwords (map prettyPrintTypeAtom ts)
433440 goSimple (DuplicateLabel l expr) = paras $ [ line $ "Duplicate label " ++ show l ++ " in row." ]
434441 <> foldMap (\expr' -> [ line "Relevant expression: "
435− , indent $ line $ prettyPrintValue expr'
442+ , indent $ line $ prettyPrintValue expr'
436443 ]) expr
437444 goSimple (DuplicateTypeArgument name) = line $ "Duplicate type argument " ++ show name
438445 goSimple (DuplicateValueDeclaration nm) = line $ "Duplicate value declaration for " ++ show nm
@@ -463,7 +470,7 @@ prettyPrintSingleError full e = prettyPrintErrorMessage <$> onTypesInErrorMessag
463470 goSimple (ShadowedName nm) = line $ "Name '" ++ show nm ++ "' was shadowed."
464471 goSimple (WildcardInferredType ty) = line $ "The wildcard type definition has the inferred type " ++ prettyPrintType ty
465472 goSimple PreludeNotPresent = paras [ line $ "There is no Prelude module loaded, and the --no-prelude option was not specified."
466− , line $ "You probably need to install the Prelude and other dependencies using Bower."
473+ , line $ "You probably need to install the Prelude and other dependencies using Bower."
467474 ]
468475 go (NotYetDefined names err) = paras [ line $ "The following are not yet defined here: " ++ intercalate ", " (map show names) ++ ":"
469476 , indent $ go err
@@ -570,10 +577,10 @@ prettyPrintSingleError full e = prettyPrintErrorMessage <$> onTypesInErrorMessag
570577 prettyPrintDictionaryValue (SubclassDictionaryValue sup nm _) = paras [ line $ (show nm) ++ " via superclass"
571578 , indent $ prettyPrintDictionaryValue sup
572579 ]
573−
580+
574581 -- |
575582 -- Pretty print and export declaration
576− --
583+ --
577584 prettyPrintExport :: DeclarationRef -> String
578585 prettyPrintExport (TypeRef pn _) = show pn
579586 prettyPrintExport (ValueRef ident) = show ident