Bogdanp / elm-ast

A parser for Elm in Elm.
http://bogdanp.github.io/elm-ast/example/
BSD 3-Clause "New" or "Revised" License
143 stars 21 forks source link

Pattern matching exception #106

Closed MajronMan closed 5 years ago

MajronMan commented 5 years ago

For some reason I had to remove PCons case from parsing of patterns

leftRecursive : Pattern -> Parser s Pattern
leftRecursive p =
    optionalParens <|
        lazy <|
            \() ->
                choice
                    [ (PAs p <$> (symbol "as" *> varName)) >>= leftRecursive

                    -- , ((PCons p) <$> (symbol "::" *> pattern)) >>= leftRecursive
                    , succeed p -- epsilon
                    ]

since when left uncommented, while running any test in tests/Pattern.elm I got This test failed because it threw an exception: "TypeError: f is not a function"