X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Data%2FData.hs;h=f812c3076c012cbdcc676e1b761d871750257287;hb=37ab854f9d2c1280117658bbd29919968f4f4585;hp=7bb6e6f535365be66487b904b889d95f5689ca88;hpb=9db75ed3a61fa1e45f13aec0aba3f0545b5a4445;p=ghc-base.git diff --git a/Data/Data.hs b/Data/Data.hs index 7bb6e6f..f812c30 100644 --- a/Data/Data.hs +++ b/Data/Data.hs @@ -17,6 +17,9 @@ -- in this module were moved to the @Data.Generics.Instances@ module -- in the @syb@ package. -- +-- For more information, please visit the new +-- SYB wiki: . +-- -- ----------------------------------------------------------------------------- @@ -51,6 +54,7 @@ module Data.Data ( mkIntType, -- :: String -> DataType mkFloatType, -- :: String -> DataType mkStringType, -- :: String -> DataType + mkNoRepType, -- :: String -> DataType mkNorepType, -- :: String -> DataType -- ** Observers dataTypeName, -- :: DataType -> String @@ -429,7 +433,7 @@ newtype Mp m x = Mp { unMp :: m (x, Bool) } -- | Build a term skeleton fromConstr :: Data a => Constr -> a -fromConstr = fromConstrB undefined +fromConstr = fromConstrB (error "Data.Data.fromConstr") -- | Build a term and use a generic function for subterms @@ -753,13 +757,20 @@ mkStringConstr dt str = case datarep dt of ------------------------------------------------------------------------------ --- | Constructs a non-representation for a non-presentable type +-- | Deprecated version (misnamed) +{-# DEPRECATED mkNorepType "Use mkNoRepType instead" #-} mkNorepType :: String -> DataType mkNorepType str = DataType { tycon = str , datarep = NoRep } +-- | Constructs a non-representation for a non-presentable type +mkNoRepType :: String -> DataType +mkNoRepType str = DataType + { tycon = str + , datarep = NoRep + } -- | Test for a non-representable type isNorepType :: DataType -> Bool @@ -1169,7 +1180,7 @@ tuple3Constr :: Constr tuple3Constr = mkConstr tuple3DataType "(,,)" [] Infix tuple3DataType :: DataType -tuple3DataType = mkDataType "Prelude.(,)" [tuple3Constr] +tuple3DataType = mkDataType "Prelude.(,,)" [tuple3Constr] instance (Data a, Data b, Data c) => Data (a,b,c) where gfoldl f z (a,b,c) = z (,,) `f` a `f` b `f` c @@ -1257,7 +1268,7 @@ instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g) instance Typeable a => Data (Ptr a) where toConstr _ = error "toConstr" gunfold _ _ = error "gunfold" - dataTypeOf _ = mkNorepType "GHC.Ptr.Ptr" + dataTypeOf _ = mkNoRepType "GHC.Ptr.Ptr" ------------------------------------------------------------------------------ @@ -1265,7 +1276,7 @@ instance Typeable a => Data (Ptr a) where instance Typeable a => Data (ForeignPtr a) where toConstr _ = error "toConstr" gunfold _ _ = error "gunfold" - dataTypeOf _ = mkNorepType "GHC.ForeignPtr.ForeignPtr" + dataTypeOf _ = mkNoRepType "GHC.ForeignPtr.ForeignPtr" ------------------------------------------------------------------------------ @@ -1276,5 +1287,5 @@ instance (Typeable a, Data b, Ix a) => Data (Array a b) gfoldl f z a = z (listArray (bounds a)) `f` (elems a) toConstr _ = error "toConstr" gunfold _ _ = error "gunfold" - dataTypeOf _ = mkNorepType "Data.Array.Array" + dataTypeOf _ = mkNoRepType "Data.Array.Array"