X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=GHC%2FRead.lhs;h=b568287e66b625a72e4c09e19ebf9b4ee5d282c8;hb=ccc7548348fa0d5a10e4c795c5edc13d0dd3f014;hp=f99e2df7588091dbcc4337819be7e2e5c5e1c99b;hpb=51a09cb97ac4404d327c821d1c9480ad6c49e65f;p=ghc-base.git diff --git a/GHC/Read.lhs b/GHC/Read.lhs index f99e2df..b568287 100644 --- a/GHC/Read.lhs +++ b/GHC/Read.lhs @@ -314,10 +314,15 @@ choose :: [(String, ReadPrec a)] -> ReadPrec a -- ^ Parse the specified lexeme and continue as specified. -- Esp useful for nullary constructors; e.g. -- @choose [(\"A\", return A), (\"B\", return B)]@ +-- We match both Ident and Symbol because the constructor +-- might be an operator eg (:=:) choose sps = foldr ((+++) . try_one) pfail sps where - try_one (s,p) = do { L.Ident s' <- lexP ; - if s == s' then p else pfail } + try_one (s,p) = do { token <- lexP ; + case token of + L.Ident s' | s==s' -> p + L.Symbol s' | s==s' -> p + _other -> pfail } \end{code}