- -- (c) optionally, bindings with no signature
- let
- (goodies, dups) = removeDups cmp_sig (sigsForMe (not . isUnboundName) sigs')
- not_this_group = sigsForMe (not . (`elemNameSet` binders)) goodies
- spec_inst_sigs = [s | s@(SpecInstSig _ _) <- goodies]
- type_sig_vars = [n | Sig n _ _ <- goodies]
- fixes = [f | f@(FixSig _) <- goodies]
- idecl_type_sigs = [s | s@(Sig _ _ _) <- goodies]
- sigs_required = case top_lev of {TopLevel -> opt_WarnMissingSigs; NotTopLevel -> False}
- un_sigd_binders | sigs_required = nameSetToList binders `minusList` type_sig_vars
- | otherwise = []
- in
- mapRn dupSigDeclErr dups `thenRn_`
- mapRn unknownSigErr not_this_group `thenRn_`
- (if not inst_decl then
- mapRn unknownSigErr spec_inst_sigs
- else
- -- We're being strict here, outlawing the presence
- -- of type signatures within an instance declaration.
- mapRn unknownSigErr (fixes ++ idecl_type_sigs)
- ) `thenRn_`
- mapRn (addWarnRn.missingSigWarn) un_sigd_binders `thenRn_`
-
- returnRn sigs' -- bad ones and all:
- -- we need bindings of *some* sort for every name
-
-
-renameSig (Sig v ty src_loc)
- = pushSrcLocRn src_loc $
- lookupBndrRn v `thenRn` \ new_v ->
- rnHsSigType (quotes (ppr v)) ty `thenRn` \ (new_ty,_) ->
- returnRn (Sig new_v new_ty src_loc)
-
-renameSig (SpecInstSig ty src_loc)
- = pushSrcLocRn src_loc $
- rnHsSigType (text "A SPECIALISE instance pragma") ty `thenRn` \ (new_ty, _) ->
- returnRn (SpecInstSig new_ty src_loc)
-
-renameSig (SpecSig v ty using src_loc)
- = pushSrcLocRn src_loc $
- lookupBndrRn v `thenRn` \ new_v ->
- rnHsSigType (quotes (ppr v)) ty `thenRn` \ (new_ty,_) ->
- rn_using using `thenRn` \ new_using ->
- returnRn (SpecSig new_v new_ty new_using src_loc)