diff options
author | Don Stewart <dons@galois.com> | 2008-03-08 01:35:56 +0000 |
---|---|---|
committer | Don Stewart <dons@galois.com> | 2008-03-08 01:35:56 +0000 |
commit | 475e70a41c3ebcac766ca76addb44ee4038cb8a5 (patch) | |
tree | 6cac1f8e5e9a0f1db88ed2ed258094e2111ad71a /libraries/base/Data | |
parent | b7703a47420a6395d0e550eb23c19810bcff9ff6 (diff) | |
download | haskell-475e70a41c3ebcac766ca76addb44ee4038cb8a5.tar.gz |
untabify
Diffstat (limited to 'libraries/base/Data')
-rw-r--r-- | libraries/base/Data/Dynamic.hs | 54 | ||||
-rw-r--r-- | libraries/base/Data/IORef.hs | 28 | ||||
-rw-r--r-- | libraries/base/Data/Unique.hs | 10 |
3 files changed, 46 insertions, 46 deletions
diff --git a/libraries/base/Data/Dynamic.hs b/libraries/base/Data/Dynamic.hs index abaffe28a1..c7b1479e7a 100644 --- a/libraries/base/Data/Dynamic.hs +++ b/libraries/base/Data/Dynamic.hs @@ -21,20 +21,20 @@ module Data.Dynamic ( - -- Module Data.Typeable re-exported for convenience - module Data.Typeable, - - -- * The @Dynamic@ type - Dynamic, -- abstract, instance of: Show, Typeable - - -- * Converting to and from @Dynamic@ - toDyn, -- :: Typeable a => a -> Dynamic - fromDyn, -- :: Typeable a => Dynamic -> a -> a - fromDynamic, -- :: Typeable a => Dynamic -> Maybe a - - -- * Applying functions of dynamic type - dynApply, - dynApp, + -- Module Data.Typeable re-exported for convenience + module Data.Typeable, + + -- * The @Dynamic@ type + Dynamic, -- abstract, instance of: Show, Typeable + + -- * Converting to and from @Dynamic@ + toDyn, -- :: Typeable a => a -> Dynamic + fromDyn, -- :: Typeable a => Dynamic -> a -> a + fromDynamic, -- :: Typeable a => Dynamic -> Maybe a + + -- * Applying functions of dynamic type + dynApply, + dynApp, dynTypeRep ) where @@ -66,7 +66,7 @@ import NHC.IOExtras (IORef,newIORef,readIORef,writeIORef,unsafePerformIO) ------------------------------------------------------------- -- --- The type Dynamic +-- The type Dynamic -- ------------------------------------------------------------- @@ -90,8 +90,8 @@ instance Show Dynamic where -- the instance just prints the type representation. showsPrec _ (Dynamic t _) = showString "<<" . - showsPrec 0 t . - showString ">>" + showsPrec 0 t . + showString ">>" #ifdef __GLASGOW_HASKELL__ type Obj = Any @@ -121,11 +121,11 @@ toDyn v = Dynamic (typeOf v) (unsafeCoerce v) -- | Converts a 'Dynamic' object back into an ordinary Haskell value of -- the correct type. See also 'fromDynamic'. fromDyn :: Typeable a - => Dynamic -- ^ the dynamically-typed object - -> a -- ^ a default value - -> a -- ^ returns: the value of the first argument, if - -- it has the correct type, otherwise the value of - -- the second argument. + => Dynamic -- ^ the dynamically-typed object + -> a -- ^ a default value + -> a -- ^ returns: the value of the first argument, if + -- it has the correct type, otherwise the value of + -- the second argument. fromDyn (Dynamic t v) def | typeOf def == t = unsafeCoerce v | otherwise = def @@ -133,11 +133,11 @@ fromDyn (Dynamic t v) def -- | Converts a 'Dynamic' object back into an ordinary Haskell value of -- the correct type. See also 'fromDyn'. fromDynamic - :: Typeable a - => Dynamic -- ^ the dynamically-typed object - -> Maybe a -- ^ returns: @'Just' a@, if the dynamically-typed - -- object has the correct type (and @a@ is its value), - -- or 'Nothing' otherwise. + :: Typeable a + => Dynamic -- ^ the dynamically-typed object + -> Maybe a -- ^ returns: @'Just' a@, if the dynamically-typed + -- object has the correct type (and @a@ is its value), + -- or 'Nothing' otherwise. fromDynamic (Dynamic t v) = case unsafeCoerce v of r | t == typeOf r -> Just r diff --git a/libraries/base/Data/IORef.hs b/libraries/base/Data/IORef.hs index 7a6ec7d4cb..1b4b110293 100644 --- a/libraries/base/Data/IORef.hs +++ b/libraries/base/Data/IORef.hs @@ -14,27 +14,27 @@ module Data.IORef ( - -- * IORefs - IORef, -- abstract, instance of: Eq, Typeable - newIORef, -- :: a -> IO (IORef a) - readIORef, -- :: IORef a -> IO a - writeIORef, -- :: IORef a -> a -> IO () - modifyIORef, -- :: IORef a -> (a -> a) -> IO () - atomicModifyIORef, -- :: IORef a -> (a -> (a,b)) -> IO b + -- * IORefs + IORef, -- abstract, instance of: Eq, Typeable + newIORef, -- :: a -> IO (IORef a) + readIORef, -- :: IORef a -> IO a + writeIORef, -- :: IORef a -> a -> IO () + modifyIORef, -- :: IORef a -> (a -> a) -> IO () + atomicModifyIORef, -- :: IORef a -> (a -> (a,b)) -> IO b #if !defined(__PARALLEL_HASKELL__) && defined(__GLASGOW_HASKELL__) - mkWeakIORef, -- :: IORef a -> IO () -> IO (Weak (IORef a)) + mkWeakIORef, -- :: IORef a -> IO () -> IO (Weak (IORef a)) #endif - ) where + ) where -import Prelude -- Explicit dependency helps 'make depend' do the right thing +import Prelude -- Explicit dependency helps 'make depend' do the right thing #ifdef __HUGS__ import Hugs.IORef #endif #ifdef __GLASGOW_HASKELL__ -import GHC.Base ( mkWeak#, atomicModifyMutVar# ) +import GHC.Base ( mkWeak#, atomicModifyMutVar# ) import GHC.STRef import GHC.IOBase #if !defined(__PARALLEL_HASKELL__) @@ -79,10 +79,10 @@ atomicModifyIORef :: IORef a -> (a -> (a,b)) -> IO b atomicModifyIORef (IORef (STRef r#)) f = IO $ \s -> atomicModifyMutVar# r# f s #elif defined(__HUGS__) -atomicModifyIORef = plainModifyIORef -- Hugs has no preemption +atomicModifyIORef = plainModifyIORef -- Hugs has no preemption where plainModifyIORef r f = do - a <- readIORef r - case f a of (a',b) -> writeIORef r a' >> return b + a <- readIORef r + case f a of (a',b) -> writeIORef r a' >> return b #elif defined(__NHC__) atomicModifyIORef r f = excludeFinalisers $ do diff --git a/libraries/base/Data/Unique.hs b/libraries/base/Data/Unique.hs index 1c1ceb88ee..502739f26d 100644 --- a/libraries/base/Data/Unique.hs +++ b/libraries/base/Data/Unique.hs @@ -14,9 +14,9 @@ module Data.Unique ( -- * Unique objects - Unique, -- instance (Eq, Ord) - newUnique, -- :: IO Unique - hashUnique -- :: Unique -> Int + Unique, -- instance (Eq, Ord) + newUnique, -- :: IO Unique + hashUnique -- :: Unique -> Int ) where import Prelude @@ -26,7 +26,7 @@ import System.IO.Unsafe (unsafePerformIO) #ifdef __GLASGOW_HASKELL__ import GHC.Base -import GHC.Num ( Integer(..) ) +import GHC.Num ( Integer(..) ) #endif -- | An abstract unique object. Objects of type 'Unique' may be @@ -55,7 +55,7 @@ hashUnique :: Unique -> Int #ifdef __GLASGOW_HASKELL__ hashUnique (Unique (S# i)) = I# i hashUnique (Unique (J# s d)) | s ==# 0# = 0 - | otherwise = I# (indexIntArray# d 0#) + | otherwise = I# (indexIntArray# d 0#) #else hashUnique (Unique u) = fromInteger (u `mod` (toInteger (maxBound :: Int) + 1)) #endif |