untabify
authorDon Stewart <dons@galois.com>
Sat, 8 Mar 2008 01:40:40 +0000 (01:40 +0000)
committerDon Stewart <dons@galois.com>
Sat, 8 Mar 2008 01:40:40 +0000 (01:40 +0000)
Control/Concurrent/QSemN.hs
Control/Concurrent/SampleVar.hs

index 56c5e50..ed96a3c 100644 (file)
 -----------------------------------------------------------------------------
 
 module Control.Concurrent.QSemN
-       (  -- * General Quantity Semaphores
-         QSemN,        -- abstract
-         newQSemN,     -- :: Int   -> IO QSemN
-         waitQSemN,    -- :: QSemN -> Int -> IO ()
-         signalQSemN   -- :: QSemN -> Int -> IO ()
+        (  -- * General Quantity Semaphores
+          QSemN,        -- abstract
+          newQSemN,     -- :: Int   -> IO QSemN
+          waitQSemN,    -- :: QSemN -> Int -> IO ()
+          signalQSemN   -- :: QSemN -> Int -> IO ()
       ) where
 
 import Prelude
@@ -63,8 +63,8 @@ signalQSemN (QSemN sem) n = do
    free avail []    = return (avail,[])
    free avail ((req,block):blocked)
      | avail >= req = do
-       putMVar block ()
-       free (avail-req) blocked
+        putMVar block ()
+        free (avail-req) blocked
      | otherwise    = do
-       (avail',blocked') <- free avail blocked
+        (avail',blocked') <- free avail blocked
         return (avail',(req,block):blocked')
index 4d88a19..8084757 100644 (file)
 
 module Control.Concurrent.SampleVar
        (
-        -- * Sample Variables
+         -- * Sample Variables
          SampleVar,         -- :: type _ =
  
-        newEmptySampleVar, -- :: IO (SampleVar a)
+         newEmptySampleVar, -- :: IO (SampleVar a)
          newSampleVar,      -- :: a -> IO (SampleVar a)
-        emptySampleVar,    -- :: SampleVar a -> IO ()
-        readSampleVar,     -- :: SampleVar a -> IO a
-        writeSampleVar,    -- :: SampleVar a -> a -> IO ()
-        isEmptySampleVar,  -- :: SampleVar a -> IO Bool
+         emptySampleVar,    -- :: SampleVar a -> IO ()
+         readSampleVar,     -- :: SampleVar a -> IO a
+         writeSampleVar,    -- :: SampleVar a -> a -> IO ()
+         isEmptySampleVar,  -- :: SampleVar a -> IO Bool
 
        ) where
 
@@ -47,9 +47,9 @@ import Control.Concurrent.MVar
 --    (different from 'putMVar' on full 'MVar'.)
 
 type SampleVar a
- = MVar (Int,          -- 1  == full
-                       -- 0  == empty
-                       -- <0 no of readers blocked
+ = MVar (Int,           -- 1  == full
+                        -- 0  == empty
+                        -- <0 no of readers blocked
           MVar a)
 
 -- |Build a new, empty, 'SampleVar'