@@ -96,6 +96,18 @@ parseModuleDeclaration = do
9696 decls <- mark (P.many (same *> parseDeclaration))
9797 return $ ModuleDeclaration name decls
9898
99+parseImportDeclaration :: P.Parsec String ParseState Declaration
100+parseImportDeclaration = do
101+ reserved "import"
102+ indented
103+ module_ <- P.sepBy1 properName (lexeme $ P.char '.')
104+ idents <- P.optionMaybe $ do
105+ lexeme $ indented *> P.char '('
106+ idents <- P.sepBy1 parseIdent (lexeme $ indented *> P.char ',')
107+ lexeme $ indented *> P.char ')'
108+ return idents
109+ return $ ImportDeclaration module_ idents
110+
99111parseDeclaration :: P.Parsec String ParseState Declaration
100112parseDeclaration = P.choice
101113 [ parseDataDeclaration
@@ -104,7 +116,8 @@ parseDeclaration = P.choice
104116 , parseValueDeclaration
105117 , parseExternDeclaration
106118 , parseFixityDeclaration
107− , parseModuleDeclaration ] P.<?> "declaration"
119+ , parseModuleDeclaration
120+ , parseImportDeclaration ] P.<?> "declaration"
108121
109122parseDeclarations :: P.Parsec String ParseState [Declaration]
110123parseDeclarations = whiteSpace *> mark (P.many (same *> parseDeclaration)) <* P.eof