- -- Check for (a) duplicate signatures
- -- (b) signatures for things not in this group
- -- (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]
- 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
- returnRn []
- ) `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)
- where
- rn_using Nothing = returnRn Nothing
- rn_using (Just x) = lookupOccRn x `thenRn` \ new_x ->
- returnRn (Just new_x)
-
-renameSig (InlineSig v src_loc)
- = pushSrcLocRn src_loc $
- lookupBndrRn v `thenRn` \ new_v ->
- returnRn (InlineSig new_v src_loc)
-
-renameSig (FixSig (FixitySig v fix src_loc))
- = pushSrcLocRn src_loc $
- lookupBndrRn v `thenRn` \ new_v ->
- returnRn (FixSig (FixitySig new_v fix src_loc))
-
-renameSig (NoInlineSig v src_loc)
- = pushSrcLocRn src_loc $
- lookupBndrRn v `thenRn` \ new_v ->
- returnRn (NoInlineSig new_v src_loc)
-\end{code}