@@ -1,8 +1,8 @@
1-----------------------------------------------------------------------------
1-----------------------------------------------------------------------------
3-- Module : Language.PureScript.Error
3-- Module : Language.PureScript.Error
4−-- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors
4+-- Copyright : (c) 2013-15 Phil Freeman, (c) 2014-15 Gary Burgess
5−-- License : MIT
5+-- License : MIT (http://opensource.org/licenses/MIT)
7-- Maintainer : Phil Freeman <paf31@cantab.net>
7-- Maintainer : Phil Freeman <paf31@cantab.net>
8-- Stability : experimental
8-- Stability : experimental
@@ -115,6 +115,7 @@ data SimpleErrorMessage
115 | PropertyIsMissing String Type
115 | PropertyIsMissing String Type
116 | CannotApplyFunction Type Expr
116 | CannotApplyFunction Type Expr
117 | TypeSynonymInstance
117 | TypeSynonymInstance
118+ | OrphanInstance Ident (Qualified ProperName) [Type]
118 | InvalidNewtype
119 | InvalidNewtype
119 | InvalidInstanceHead Type
120 | InvalidInstanceHead Type
120 | TransitiveExportError DeclarationRef [DeclarationRef]
121 | TransitiveExportError DeclarationRef [DeclarationRef]
@@ -226,6 +227,7 @@ errorCode em = case unwrapErrorMessage em of
226 (PropertyIsMissing _ _) -> "PropertyIsMissing"
227 (PropertyIsMissing _ _) -> "PropertyIsMissing"
227 (CannotApplyFunction _ _) -> "CannotApplyFunction"
228 (CannotApplyFunction _ _) -> "CannotApplyFunction"
228 TypeSynonymInstance -> "TypeSynonymInstance"
229 TypeSynonymInstance -> "TypeSynonymInstance"
230+ (OrphanInstance _ _ _) -> "OrphanInstance"
229 InvalidNewtype -> "InvalidNewtype"
231 InvalidNewtype -> "InvalidNewtype"
230 (InvalidInstanceHead _) -> "InvalidInstanceHead"
232 (InvalidInstanceHead _) -> "InvalidInstanceHead"
231 (TransitiveExportError _ _) -> "TransitiveExportError"
233 (TransitiveExportError _ _) -> "TransitiveExportError"
@@ -545,6 +547,8 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage <$> onTypesInError
546 goSimple TypeSynonymInstance =
548 goSimple TypeSynonymInstance =
547 line "Type synonym instances are disallowed"
549 line "Type synonym instances are disallowed"
550+ goSimple (OrphanInstance nm cnm ts) =
551+ line $ "Instance " ++ show nm ++ " for " ++ show cnm ++ " " ++ unwords (map prettyPrintTypeAtom ts) ++ " is an orphan instance"
548 goSimple InvalidNewtype =
552 goSimple InvalidNewtype =
549 line "Newtypes must define a single constructor with a single argument"
553 line "Newtypes must define a single constructor with a single argument"
550 goSimple (InvalidInstanceHead ty) =
554 goSimple (InvalidInstanceHead ty) =