summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Internal/Common.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2007-09-08 09:46:33 +0000
committerAlberto Ruiz <aruiz@um.es>2007-09-08 09:46:33 +0000
commit34380f2b5d7b048a4d68197f16a8db0e53742030 (patch)
tree444aff88cda5c247d49bac0d294d8cfb9ef7bf23 /lib/Data/Packed/Internal/Common.hs
parent0c38c1b0e122a56ea98c494e60ba90afe2688664 (diff)
type classes
Diffstat (limited to 'lib/Data/Packed/Internal/Common.hs')
-rw-r--r--lib/Data/Packed/Internal/Common.hs18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/Data/Packed/Internal/Common.hs b/lib/Data/Packed/Internal/Common.hs
index 1bfed6d..1212968 100644
--- a/lib/Data/Packed/Internal/Common.hs
+++ b/lib/Data/Packed/Internal/Common.hs
@@ -28,7 +28,7 @@ debug x = trace (show x) x
28data Vector t = V { dim :: Int 28data Vector t = V { dim :: Int
29 , fptr :: ForeignPtr t 29 , fptr :: ForeignPtr t
30 , ptr :: Ptr t 30 , ptr :: Ptr t
31 } deriving Typeable 31 } -- deriving Typeable
32 32
33---------------------------------------------------------------------- 33----------------------------------------------------------------------
34instance (Storable a, RealFloat a) => Storable (Complex a) where -- 34instance (Storable a, RealFloat a) => Storable (Complex a) where --
@@ -78,17 +78,17 @@ check msg ls f = do
78 mapM_ (touchForeignPtr . fptr) ls 78 mapM_ (touchForeignPtr . fptr) ls
79 return () 79 return ()
80 80
81class (Storable a, Typeable a) => Field a 81--class (Storable a, Typeable a) => Field a
82instance (Storable a, Typeable a) => Field a 82--instance (Storable a, Typeable a) => Field a
83 83
84isReal :: (Data.Typeable.Typeable a) => (t -> a) -> t -> Bool 84--isReal :: (Data.Typeable.Typeable a) => (t -> a) -> t -> Bool
85isReal w x = typeOf (undefined :: Double) == typeOf (w x) 85--isReal w x = typeOf (undefined :: Double) == typeOf (w x)
86 86
87isComp :: (Data.Typeable.Typeable a) => (t -> a) -> t -> Bool 87--isComp :: (Data.Typeable.Typeable a) => (t -> a) -> t -> Bool
88isComp w x = typeOf (undefined :: Complex Double) == typeOf (w x) 88--isComp w x = typeOf (undefined :: Complex Double) == typeOf (w x)
89 89
90scast :: forall a . forall b . (Typeable a, Typeable b) => a -> b 90--scast :: forall a . forall b . (Typeable a, Typeable b) => a -> b
91scast = fromJust . cast 91--scast = fromJust . cast
92 92
93{- | conversion of Haskell functions into function pointers that can be used in the C side 93{- | conversion of Haskell functions into function pointers that can be used in the C side
94-} 94-}