* Bogus report of overlapped pattern for
f (R {field = [c]}) = 1
f (R {}) = 2
- This shows up for TyCon.maybeTyConSingleCon
+ This shows up for TyCon.tyConSingleDataCon_maybe
* > module Main( main ) where
else if isPrimTyCon tycon {- array, we hope -} then 'A' -- Bogus
else if isEnumerationTyCon tycon then 'E'
else if isTupleTyCon tycon then 'T'
- else if isJust (maybeTyConSingleCon tycon) then 'S'
+ else if isJust (tyConSingleDataCon_maybe tycon) then 'S'
else if utc == listTyConKey then 'L'
else 'M' -- oh, well...
pprNewtypeWrap y p NewtypeWrap{ty=ty, wrapped_term=t}
| Just (tc,_) <- splitNewTyConApp_maybe ty
, ASSERT(isNewTyCon tc) True
- , Just new_dc <- maybeTyConSingleCon tc = do
+ , Just new_dc <- tyConSingleDataCon_maybe tc = do
real_term <- y max_prec t
return$ cparen (p >= app_prec) (ppr new_dc <+> real_term)
pprNewtypeWrap _ _ _ = panic "pprNewtypeWrap"
| Just (tc, args) <- splitNewTyConApp_maybe ty
, isNewTyCon tc
, wrapped_type <- newTyConInstRhs tc args
- , Just dc <- maybeTyConSingleCon tc
+ , Just dc <- tyConSingleDataCon_maybe tc
, t' <- expandNewtypes t{ ty = wrapped_type
, subTerms = map expandNewtypes tt }
= NewtypeWrap ty (Right dc) t'
no_nullary_cons = null nullary_cons
rest | no_nullary_cons
- = case maybeTyConSingleCon tycon of
+ = case tyConSingleDataCon_maybe tycon of
Just _ -> []
Nothing -> -- if cons don't match, then False
[([nlWildPat, nlWildPat], false_Expr)]
= listToBag [single_con_range, single_con_index, single_con_inRange]
data_con
- = case maybeTyConSingleCon tycon of -- just checking...
+ = case tyConSingleDataCon_maybe tycon of -- just checking...
Nothing -> panic "get_Ix_binds"
Just dc | any isUnLiftedType (dataConOrigArgTys dc)
-> pprPanic "Can't derive Ix for a single-constructor type with primitive argument types:" (ppr tycon)
synTyConDefn, synTyConRhs, synTyConType, synTyConResKind,
tyConExtName, -- External name for foreign types
- maybeTyConSingleCon,
+ tyConSingleDataCon_maybe,
-- Generics
tyConHasGenerics
\end{code}
\begin{code}
-maybeTyConSingleCon :: TyCon -> Maybe DataCon
-maybeTyConSingleCon (AlgTyCon {algTcRhs = DataTyCon {data_cons = [c] }}) = Just c
-maybeTyConSingleCon (AlgTyCon {algTcRhs = NewTyCon { data_con = c }}) = Just c
-maybeTyConSingleCon (AlgTyCon {}) = Nothing
-maybeTyConSingleCon (TupleTyCon {dataCon = con}) = Just con
-maybeTyConSingleCon (PrimTyCon {}) = Nothing
-maybeTyConSingleCon (FunTyCon {}) = Nothing -- case at funty
-maybeTyConSingleCon tc = pprPanic "maybeTyConSingleCon: unexpected tycon " $ ppr tc
+tyConSingleDataCon_maybe :: TyCon -> Maybe DataCon
+tyConSingleDataCon_maybe (AlgTyCon {algTcRhs = DataTyCon {data_cons = [c] }}) = Just c
+tyConSingleDataCon_maybe (AlgTyCon {algTcRhs = NewTyCon { data_con = c }}) = Just c
+tyConSingleDataCon_maybe (AlgTyCon {}) = Nothing
+tyConSingleDataCon_maybe (TupleTyCon {dataCon = con}) = Just con
+tyConSingleDataCon_maybe (PrimTyCon {}) = Nothing
+tyConSingleDataCon_maybe (FunTyCon {}) = Nothing -- case at funty
+tyConSingleDataCon_maybe tc = pprPanic "tyConSingleDataCon_maybe: unexpected tycon " $ ppr tc
\end{code}
\begin{code}