-@mk_easy_FunMonoBind fun pats binds expr@ generates:
-\begin{verbatim}
- fun pat1 pat2 ... patN = expr where binds
-\end{verbatim}
-
-@mk_FunMonoBind fun [([p1a, p1b, ...], e1), ...]@ is for
-multi-clause definitions; it generates:
-\begin{verbatim}
- fun p1a p1b ... p1N = e1
- fun p2a p2b ... p2N = e2
- ...
- fun pMa pMb ... pMN = eM
-\end{verbatim}
-
-\begin{code}
-mkVarMonoBind :: SrcLoc -> RdrName -> RdrNameHsExpr -> RdrNameMonoBinds
-mkVarMonoBind loc var rhs = mk_easy_FunMonoBind loc var [] [] rhs
-
-mk_easy_FunMonoBind :: SrcLoc -> RdrName -> [RdrNamePat]
- -> [RdrNameMonoBinds] -> RdrNameHsExpr
- -> RdrNameMonoBinds
-
-mk_easy_FunMonoBind loc fun pats binds expr
- = FunMonoBind fun False{-not infix-} [mk_easy_Match loc pats binds expr] loc
-
-mk_easy_Match loc pats binds expr
- = mk_match loc pats expr (mkMonoBind Recursive (andMonoBindList binds))
- -- The renamer expects everything in its input to be a
- -- "recursive" MonoBinds, and it is its job to sort things out
- -- from there.
-
-mk_FunMonoBind :: SrcLoc -> RdrName
- -> [([RdrNamePat], RdrNameHsExpr)]
- -> RdrNameMonoBinds
-
-mk_FunMonoBind loc fun [] = panic "TcGenDeriv:mk_FunMonoBind"
-mk_FunMonoBind loc fun pats_and_exprs
- = FunMonoBind fun False{-not infix-}
- [ mk_match loc p e EmptyBinds | (p,e) <-pats_and_exprs ]
- loc
-
-mk_match loc pats expr binds
- = Match (map paren pats) Nothing
- (GRHSs (unguardedRHS expr loc) binds placeHolderType)
- where
- paren p@(VarPat _) = p
- paren other_p = ParPat other_p
-
-mkWildConPat :: DataCon -> Pat RdrName
-mkWildConPat con = ConPatIn (getRdrName con) (PrefixCon (nOfThem (dataConSourceArity con) wildPat))
-
-wildPat :: Pat id
-wildPat = WildPat placeHolderType -- Pre-typechecking
-\end{code}