[commit: base] master: Add dataCast* definitions to Ptr/Array Data instances; fixes #7256 (151c2fc)
Ian Lynagh
igloo at earth.li
Fri Nov 30 15:13:57 CET 2012
Repository : ssh://darcs.haskell.org//srv/darcs/packages/base
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/151c2fc732beeddf0306af0d0b374e3029aea49e
>---------------------------------------------------------------
commit 151c2fc732beeddf0306af0d0b374e3029aea49e
Author: Ian Lynagh <ian at well-typed.com>
Date: Fri Nov 30 13:18:41 2012 +0000
Add dataCast* definitions to Ptr/Array Data instances; fixes #7256
Patch from dreixel.
>---------------------------------------------------------------
Data/Data.hs | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Data/Data.hs b/Data/Data.hs
index 06f5732..d961086 100644
--- a/Data/Data.hs
+++ b/Data/Data.hs
@@ -1275,27 +1275,27 @@ instance (Data a, Data b, Data c, Data d, Data e, Data f, Data g)
------------------------------------------------------------------------------
-instance Typeable a => Data (Ptr a) where
+instance (Data a, Typeable a) => Data (Ptr a) where
toConstr _ = error "Data.Data.toConstr(Ptr)"
gunfold _ _ = error "Data.Data.gunfold(Ptr)"
dataTypeOf _ = mkNoRepType "GHC.Ptr.Ptr"
-
+ dataCast1 x = gcast1 x
------------------------------------------------------------------------------
-instance Typeable a => Data (ForeignPtr a) where
+instance (Data a, Typeable a) => Data (ForeignPtr a) where
toConstr _ = error "Data.Data.toConstr(ForeignPtr)"
gunfold _ _ = error "Data.Data.gunfold(ForeignPtr)"
dataTypeOf _ = mkNoRepType "GHC.ForeignPtr.ForeignPtr"
-
+ dataCast1 x = gcast1 x
------------------------------------------------------------------------------
-- The Data instance for Array preserves data abstraction at the cost of
-- inefficiency. We omit reflection services for the sake of data abstraction.
-instance (Typeable a, Data b, Ix a) => Data (Array a b)
+instance (Typeable a, Data a, Data b, Ix a) => Data (Array a b)
where
gfoldl f z a = z (listArray (bounds a)) `f` (elems a)
toConstr _ = error "Data.Data.toConstr(Array)"
gunfold _ _ = error "Data.Data.gunfold(Array)"
dataTypeOf _ = mkNoRepType "Data.Array.Array"
-
+ dataCast2 x = gcast2 x
More information about the Cvs-libraries
mailing list