- Nothing -> return (pcs0, []);
- Just rdr_name -> do
-
- -- if the identifier is a constructor (begins with an
- -- upper-case letter), then we need to consider both
- -- constructor and type class identifiers.
- let rdr_names
- | occNameSpace occ == dataName = [ rdr_name, tccls_name ]
- | otherwise = [ rdr_name ]
- where
- occ = rdrNameOcc rdr_name
- tccls_occ = setOccNameSpace occ tcClsName
- tccls_name = setRdrNameOcc rdr_name tccls_occ
-
- (pcs, unqual, maybe_rn_result) <-
- renameRdrName dflags hit hst pcs0 ic rdr_names
-
- case maybe_rn_result of {
- Nothing -> return (pcs, []);
- Just (names, decls) -> do {
-
- maybe_pcs <- typecheckExtraDecls dflags pcs hst unqual
- iNTERACTIVE decls;
-
- case maybe_pcs of {
- Nothing -> return (pcs, []);
- Just pcs ->
- let do_lookup n
- | isLocalName n = lookupNameEnv (ic_type_env ic) n
- | otherwise = lookupType hst (pcs_PTE pcs) n
-
- maybe_ty_things = map do_lookup names
- in
- return (pcs, catMaybes maybe_ty_things) }
- }}}
-
-myParseIdentifier dflags str
- = do buf <- stringToStringBuffer str
-
- let exts = ExtFlags {glasgowExtsEF = dopt Opt_GlasgowExts dflags,
- parrEF = dopt Opt_PArr dflags}
- loc = mkSrcLoc SLIT("<interactive>") 1
-
- case parseIdentifier buf (mkPState loc exts) of
-
- PFailed err -> do { hPutStrLn stderr (showSDoc err);
- freeStringBuffer buf;
- return Nothing }
-
- POk _ rdr_name -> do { --should, but can't: freeStringBuffer buf;
- return (Just rdr_name) }