- fun_matches = matches, bind_fvs = fvs })]
- sig_fn -- Single function binding,
- NonRecursive -- binder isn't mentioned in RHS,
- | Nothing <- sig_fn name -- ...with no type signature
- = -- In this very special case we infer the type of the
- -- right hand side first (it may have a higher-rank type)
- -- and *then* make the monomorphic Id for the LHS
- -- e.g. f = \(x::forall a. a->a) -> <body>
- -- We want to infer a higher-rank type for f
- setSrcSpan b_loc $
- do { ((co_fn, matches'), rhs_ty) <- tcInfer (tcMatchesFun name inf matches)
-
- -- Check for an unboxed tuple type
- -- f = (# True, False #)
- -- Zonk first just in case it's hidden inside a meta type variable
- -- (This shows up as a (more obscure) kind error
- -- in the 'otherwise' case of tcMonoBinds.)
- ; zonked_rhs_ty <- zonkTcType rhs_ty
- ; checkTc (not (isUnboxedTupleType zonked_rhs_ty))
- (unboxedTupleErr name zonked_rhs_ty)
-
- ; mono_name <- newLocalName name
- ; let mono_id = mkLocalId mono_name zonked_rhs_ty
- ; return (unitBag (L b_loc (FunBind { fun_id = L nm_loc mono_id, fun_infix = inf,
- fun_matches = matches', bind_fvs = fvs,
- fun_co_fn = co_fn, fun_tick = Nothing })),
- [(name, Nothing, mono_id)]) }
+ fun_matches = matches, bind_fvs = fvs })]
+ sig_fn -- Single function binding,
+ NonRecursive -- binder isn't mentioned in RHS,
+ | Nothing <- sig_fn name -- ...with no type signature
+ = -- In this very special case we infer the type of the
+ -- right hand side first (it may have a higher-rank type)
+ -- and *then* make the monomorphic Id for the LHS
+ -- e.g. f = \(x::forall a. a->a) -> <body>
+ -- We want to infer a higher-rank type for f
+ setSrcSpan b_loc $
+ do { ((co_fn, matches'), rhs_ty) <- tcInfer (tcMatchesFun name inf matches)
+
+ -- Check for an unboxed tuple type
+ -- f = (# True, False #)
+ -- Zonk first just in case it's hidden inside a meta type variable
+ -- (This shows up as a (more obscure) kind error
+ -- in the 'otherwise' case of tcMonoBinds.)
+ ; zonked_rhs_ty <- zonkTcType rhs_ty
+ ; checkTc (not (isUnboxedTupleType zonked_rhs_ty))
+ (unboxedTupleErr name zonked_rhs_ty)
+
+ ; mono_name <- newLocalName name
+ ; let mono_id = mkLocalId mono_name zonked_rhs_ty
+ ; return (unitBag (L b_loc (FunBind { fun_id = L nm_loc mono_id, fun_infix = inf,
+ fun_matches = matches', bind_fvs = fvs,
+ fun_co_fn = co_fn, fun_tick = Nothing })),
+ [(name, Nothing, mono_id)]) }