@@ -18,6 +18,7 @@ module Language.PureScript.Parser.Declarations (
1818 parseModules
1919) where
2020
21+import Data.Maybe (fromMaybe)
2122import Control.Applicative
2223import qualified Text.Parsec as P
2324
@@ -108,11 +109,16 @@ parseTypeClassDeclaration = do
108109parseTypeInstanceDeclaration :: P.Parsec String ParseState Declaration
109110parseTypeInstanceDeclaration = do
110111 reserved "instance"
112+ deps <- do
113+ deps <- P.optionMaybe (parens (commaSep1 ((,) <$> parseQualified properName <*> parseType)))
114+ indented
115+ reservedOp "=>"
116+ return deps
111117 className <- indented *> parseQualified properName
112118 ty <- indented *> parseType
113119 indented *> reserved "where"
114120 members <- mark (P.many (same *> parseValueDeclaration))
115− return $ TypeInstanceDeclaration className ty members
121+ return $ TypeInstanceDeclaration (fromMaybe [] deps) className ty members
116122
117123parseDeclaration :: P.Parsec String ParseState Declaration
118124parseDeclaration = P.choice