Skip to content

Confusing error message in empty pattern for Data.Complex #366

@chshersh

Description

@chshersh

Module Data.Complex from base-4.9.1.0 package fails to parse. When running from REPL:

ghci> parseFile "Complex.hs"
ParseFailed (SrcLoc "Complex.hs" 230 1) "Parse error in pattern: "

At least there's bug in parser somewhere. But it's bad that error message is not helpful enough :(

Relevant lines where parser fails:

226|instance Applicative Complex where
227|  pure a = a :+ a
228|  f :+ g <*> a :+ b = f a :+ g b
229|
230|instance Monad Complex where
231|  a :+ b >>= f = realPart (f a) :+ imagPart (f b)

When I comment line 228 everything works. So parser error in fact is in line number 228.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions