X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FbasicTypes%2FDataCon.lhs;h=f367ada0f686e08f68581cdd16fac34f70e7c234;hb=e2587381bec9e1ef5953c2596c4090af05d39aac;hp=cca021ca9b398dd96cb4cd112e96c4768e6217f7;hpb=63168f876689d210ada5c5a8e9de3a6b39cc9fe6;p=ghc-hetmet.git diff --git a/compiler/basicTypes/DataCon.lhs b/compiler/basicTypes/DataCon.lhs index cca021c..f367ada 100644 --- a/compiler/basicTypes/DataCon.lhs +++ b/compiler/basicTypes/DataCon.lhs @@ -51,10 +51,10 @@ import Outputable import Unique import ListSetOps import Util -import Maybes import FastString import Module +import qualified Data.Data as Data import Data.Char import Data.Word import Data.List ( partition ) @@ -98,12 +98,12 @@ Note [Data Constructor Naming] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Each data constructor C has two, and possibly up to four, Names associated with it: - OccName Name space Name of - --------------------------------------------------------------------------- - * The "data con itself" C DataName DataCon - * The "worker data con" C VarName Id (the worker) - * The "wrapper data con" \$WC VarName Id (the wrapper) - * The "newtype coercion" :CoT TcClsName TyCon + OccName Name space Name of Notes + --------------------------------------------------------------------------- + The "data con itself" C DataName DataCon In dom( GlobalRdrEnv ) + The "worker data con" C VarName Id The worker + The "wrapper data con" $WC VarName Id The wrapper + The "newtype coercion" :CoT TcClsName TyCon EVERY data constructor (incl for newtypes) has the former two (the data con itself, and its worker. But only some data constructors have a @@ -342,7 +342,8 @@ data DataCon -- after unboxing and flattening, -- and *including* existential dictionaries - dcRepStrictness :: [StrictnessMark], -- One for each *representation* argument + dcRepStrictness :: [StrictnessMark], -- One for each *representation* + -- *value* argument -- See also Note [Data-con worker strictness] in MkId.lhs -- Result type of constructor is T t1..tn @@ -455,6 +456,15 @@ instance Outputable DataCon where instance Show DataCon where showsPrec p con = showsPrecSDoc p (ppr con) + +instance Data.Typeable DataCon where + typeOf _ = Data.mkTyConApp (Data.mkTyCon "DataCon") [] + +instance Data.Data DataCon where + -- don't traverse? + toConstr _ = abstractConstr "DataCon" + gunfold _ _ = error "gunfold" + dataTypeOf _ = mkNoRepType "DataCon" \end{code}