- (spec_binds, rules) = unzip (catMaybes mb_specs)
- global' = addIdSpecialisations global rules
- rhs' = mkLams tyvars $ mkLams dicts $ Let core_bind (Var local)
- bind = addInlinePrags prags global' $ addAutoScc auto_scc global' rhs'
- in
- returnDs (bind : spec_binds ++ rest)
+ -- Always treat the binds as recursive, because the typechecker
+ -- makes rather mixed-up dictionary bindings
+ core_bind = Rec core_prs
+
+ mb_specs <- mapM (dsSpec all_tyvars dicts tyvars global local core_bind) prags
+ let
+ (spec_binds, rules) = unzip (catMaybes mb_specs)
+ global' = addIdSpecialisations global rules
+ rhs' = mkLams tyvars $ mkLams dicts $ Let core_bind (Var local)
+ bind = addInlinePrags prags global' $ addAutoScc auto_scc global' rhs'
+
+ return (bind : spec_binds ++ rest)