-- Friends
import HsExpr ( HsExpr, Stmt(..) )
import HsBinds ( HsBinds(..), nullBinds )
-import HsTypes ( HsTyVar, HsType )
-
+import HsTypes ( HsType )
-- Others
import Type ( Type )
import SrcLoc ( SrcLoc )
import Outputable
-import Name ( NamedThing )
+import List
\end{code}
%************************************************************************
\begin{code}
data Match id pat
= Match
- [HsTyVar id] -- Tyvars wrt which this match is universally quantified
- -- emtpy after typechecking
- [pat] -- The patterns
- (Maybe (HsType id)) -- A type signature for the result of the match
- -- Nothing after typechecking
+ [id] -- Tyvars wrt which this match is universally quantified
+ -- empty after typechecking
+ [pat] -- The patterns
+ (Maybe (HsType id)) -- A type signature for the result of the match
+ -- Nothing after typechecking
(GRHSs id pat)
We know the list must have at least one @Match@ in it.
\begin{code}
-pprMatches :: (NamedThing id, Outputable id, Outputable pat)
+pprMatches :: (Outputable id, Outputable pat)
=> (Bool, SDoc) -> [Match id pat] -> SDoc
pprMatches print_info matches = vcat (map (pprMatch print_info) matches)
-pprMatch :: (NamedThing id, Outputable id, Outputable pat)
+pprMatch :: (Outputable id, Outputable pat)
=> (Bool, SDoc) -> Match id pat -> SDoc
pprMatch print_info@(is_case, name) (Match _ pats maybe_ty grhss)
= maybe_name <+> sep [sep (map ppr pats),
Nothing -> empty
-pprGRHSs :: (NamedThing id, Outputable id, Outputable pat)
+pprGRHSs :: (Outputable id, Outputable pat)
=> Bool -> GRHSs id pat -> SDoc
pprGRHSs is_case (GRHSs grhss binds maybe_ty)
= vcat (map (pprGRHS is_case) grhss)
else text "where" $$ nest 4 (pprDeeper (ppr binds)))
-pprGRHS :: (NamedThing id, Outputable id, Outputable pat)
+pprGRHS :: (Outputable id, Outputable pat)
=> Bool -> GRHS id pat -> SDoc
pprGRHS is_case (GRHS [ExprStmt expr _] locn)
ExprStmt expr _ = last guarded -- Last stmt should be a ExprStmt for guards
guards = init guarded
\end{code}
+