Possible issue with isBuiltInOcc_maybe

Alan & Kim Zimmerman alan.zimm at gmail.com
Thu Jan 1 11:03:40 UTC 2015


I am busy checking that I can exactprint all the RdrNames produced by the
parser, and came across this

isBuiltInOcc_maybe occ
  = case occNameString occ of
        "[]"             -> choose_ns listTyCon nilDataCon
        ":"              -> Just consDataConName
        "[::]"           -> Just parrTyConName
        "(##)"           -> choose_ns unboxedUnitTyCon unboxedUnitDataCon
        "()"             -> choose_ns unitTyCon        unitDataCon
        '(':'#':',':rest -> parse_tuple UnboxedTuple 2 rest
        '(':',':rest     -> parse_tuple BoxedTuple   2 rest
        _other           -> Nothing

The above code does not allow any spaces between '[' and ']', or '[:' and
':]' (for example)

However, the parse rules DO allow spaces

        | '[' ']'               {% ams (sLL $1 $> $ listTyCon_RDR) [mos
$1,mcs $2] }
        | '[:' ':]'             {% ams (sLL $1 $> $ parrTyCon_RDR) [mo
$1,mc $2] }

Is this a problem?

Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20150101/df7968ce/attachment.html>


More information about the ghc-devs mailing list