@@ -63,7 +63,7 @@ parseTypeConstructor = TypeConstructor <$> parseQualified properName
6363
6464parseForAll :: TokenParser Type
6565parseForAll = mkForAll <$> (P.try (reserved "forall") *> P.many1 (indented *> identifier) <* indented <* dot)
66− <*> parseConstrainedType
66+ <*> parseType
6767
6868-- |
6969-- Parse a type as it appears in e.g. a data constructor
@@ -79,21 +79,21 @@ parseTypeAtom = indented *> P.choice (map P.try
7979 , parseTypeConstructor
8080 , parseForAll
8181 , parens parseRow
82− , parens parsePolyType ])
82+ , parseConstrainedType
83+ , parens parsePolyType
84+ ])
8385
8486parseConstrainedType :: TokenParser Type
8587parseConstrainedType = do
86− constraints <- P.optionMaybe . P.try $ do
87− constraints <- parens . commaSep1 $ do
88− className <- parseQualified properName
89− indented
90− ty <- P.many parseTypeAtom
91− return (className, ty)
92− _ <- rfatArrow
93− return constraints
88+ constraints <- parens . commaSep1 $ do
89+ className <- parseQualified properName
90+ indented
91+ ty <- P.many parseTypeAtom
92+ return (className, ty)
93+ _ <- rfatArrow
9494 indented
9595 ty <- parseType
96− return $ maybe ty (flip ConstrainedType ty) constraints
96+ return $ ConstrainedType constraints ty
9797
9898parseAnyType :: TokenParser Type
9999parseAnyType = P.buildExpressionParser operators (buildPostfixParser postfixTable parseTypeAtom) P.<?> "type"