%
+% (c) The University of Glasgow 2006
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
-\section[DsListComp]{Desugaring list comprehensions and array comprehensions}
+
+Desugaring list comprehensions and array comprehensions
\begin{code}
module DsListComp ( dsListComp, dsPArrComp ) where
import {-# SOURCE #-} DsExpr ( dsLExpr, dsLocalBinds )
-import BasicTypes ( Boxity(..) )
+import BasicTypes
import HsSyn
-import TcHsSyn ( hsPatType, mkVanillaTuplePat )
+import TcHsSyn
import CoreSyn
import DsMonad -- the monadery used in the desugarer
import DsUtils
-import DynFlags ( DynFlag(..), dopt )
-import StaticFlags ( opt_RulesOff )
-import CoreUtils ( exprType, mkIfThenElse )
-import Id ( idType )
-import Var ( Id )
-import Type ( mkTyVarTy, mkFunTys, mkFunTy, Type,
- splitTyConApp_maybe )
-import TysPrim ( alphaTyVar )
-import TysWiredIn ( nilDataCon, consDataCon, trueDataConId, falseDataConId,
- unitDataConId, unitTy, mkListTy, parrTyCon )
-import Match ( matchSimply )
-import PrelNames ( foldrName, buildName, replicatePName, mapPName,
- filterPName, zipPName, crossPName )
-import PrelInfo ( pAT_ERROR_ID )
-import SrcLoc ( noLoc, unLoc )
-import Panic ( panic )
+import DynFlags
+import StaticFlags
+import CoreUtils
+import Var
+import Type
+import TysPrim
+import TysWiredIn
+import Match
+import PrelNames
+import PrelInfo
+import SrcLoc
+import Panic
\end{code}
List comprehensions may be desugared in one of two ways: ``ordinary''
u3_ty@u1_ty = exprType core_list1 -- two names, same thing
-- u1_ty is a [alpha] type, and u2_ty = alpha
- u2_ty = hsPatType pat
+ u2_ty = hsLPatType pat
res_ty = exprType core_list2
h_ty = u1_ty `mkFunTy` res_ty
= dsLExpr list1 `thenDs` \ core_list1 ->
-- find the required type
- let x_ty = hsPatType pat
+ let x_ty = hsLPatType pat
b_ty = idType n_id
in