Rename maybeTyConSingleCon to tyConSingleDataCon_maybe
authorMax Bolingbroke <batterseapower@hotmail.com>
Thu, 31 Jul 2008 01:05:37 +0000 (01:05 +0000)
committerMax Bolingbroke <batterseapower@hotmail.com>
Thu, 31 Jul 2008 01:05:37 +0000 (01:05 +0000)
compiler/Simon-log
compiler/codeGen/CgTicky.hs
compiler/ghci/RtClosureInspect.hs
compiler/typecheck/TcGenDeriv.lhs
compiler/types/TyCon.lhs

index 9d60ccc..3d2804d 100644 (file)
@@ -710,7 +710,7 @@ To-do
 * 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
 
index 7f89505..2494740 100644 (file)
@@ -380,6 +380,6 @@ showTypeCategory ty
          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...
index 1b8616a..509eb99 100644 (file)
@@ -386,7 +386,7 @@ ppr_termM1 NewtypeWrap{} = panic "ppr_termM1 - NewtypeWrap"
 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"
@@ -682,7 +682,7 @@ cvObtainTerm hsc_env bound force mb_ty hval = runTR hsc_env $ do
    | 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'
index 1a0043a..a7956e4 100644 (file)
@@ -156,7 +156,7 @@ gen_Eq_binds loc tycon
     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)]
@@ -680,7 +680,7 @@ gen_Ix_binds loc tycon
       = 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)
index e6366be..d7347a8 100644 (file)
@@ -61,7 +61,7 @@ module TyCon(
        synTyConDefn, synTyConRhs, synTyConType, synTyConResKind,
        tyConExtName,           -- External name for foreign types
 
-        maybeTyConSingleCon,
+        tyConSingleDataCon_maybe,
 
        -- Generics
         tyConHasGenerics
@@ -932,14 +932,14 @@ synTyConResKind tycon  = pprPanic "synTyConResKind" (ppr tycon)
 \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}