#include "HsVersions.h"
import TypeRep ( Type(..), TyNote(..) ) -- friend
-import TyCon ( TyCon, ArgVrcs, tyConArity, tyConDataConsIfAvailable, tyConTyVars,
+import TyCon ( TyCon, ArgVrcs, tyConArity, tyConDataCons_maybe, tyConDataCons, tyConTyVars,
tyConArgVrcs_maybe, getSynTyConDefn, isSynTyCon, isAlgTyCon )
import DataCon ( dataConRepArgTys )
import Var ( TyVar )
import VarSet
import Maybes ( expectJust )
+import Maybe ( isNothing )
import Outputable
\end{code}
initial_oi :: FiniteMap TyCon ArgVrcs
initial_oi = foldl (\fm tc -> addToFM fm tc (initial tc)) emptyFM tycons
- initial tc = if isAlgTyCon tc && null (tyConDataConsIfAvailable tc) then
+ initial tc = if isAlgTyCon tc && isNothing (tyConDataCons_maybe tc) then
-- make pessimistic assumption (and warn)
abstractVrcs tc
else
map (\v -> anyVrc (\ty -> vrcInTy myfao v ty) argtys)
vs
where
- data_cons = tyConDataConsIfAvailable tc
+ data_cons = tyConDataCons tc
vs = tyConTyVars tc
argtys = concatMap dataConRepArgTys data_cons
myfao tc = lookupWithDefaultFM oi (expectJust "tcaoIter(Alg)" $
vrcInTy fao v (TyConApp tc tys) = let pms1 = map (vrcInTy fao v) tys
pms2 = fao tc
in orVrcs (zipWith timesVrc pms1 pms2)
-
-vrcInTy fao v (UsageTy u ty) = vrcInTy fao v u `orVrc` vrcInTy fao v ty
\end{code}