packages feed

unamb 0.0 → 0.0.1

raw patch · 3 files changed

+19/−15 lines, 3 files

Files

src/Data/Unamb.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE PatternSignatures #-}+{-# LANGUAGE ScopedTypeVariables #-} {-# OPTIONS_GHC -Wall #-} ---------------------------------------------------------------------- -- |@@ -43,14 +43,13 @@ -- whichever finishes first.  See also 'amb'.  Thanks to Spencer Janssen -- for this simple version. race :: IO a -> IO a -> IO a-race a b = do-    v <- newEmptyMVar-    ta <- forkIO (a >>= putMVar v)-    tb <- forkIO (b >>= putMVar v)-    x <- takeMVar v-    -- TODO: why forkIO in the next line?-    forkIO (killThread ta >> killThread tb)-    return x+a `race` b = do v  <- newEmptyMVar+                ta <- forkIO (a >>= putMVar v)+                tb <- forkIO (b >>= putMVar v)+                x  <- takeMVar v+                killThread ta+                killThread tb+                return x  -- Without using unsafePerformIO, is there a way to define a -- non-terminating but non-erroring pure value that consume very little
tests/Tests.hs view
@@ -35,8 +35,11 @@    unambt :: NumT -> NumT -> NumT    unambt = unamb --- The commutative and associative test take a long time because of the--- intentional delays.  I don't understand the magnitude of the delays,--- however.  They appear to be 1000 times what I'd expect.  For instance,--- 0.00001 sec time 500 tests is 5 milliseconds, but I count about 10--- seconds.+-- On Windows the commutative and associative test take a long time+-- because of the intentional delays.  I don't understand the magnitude of+-- the delays, however.  They appear to be 1000 times what I'd expect.+-- For instance, 0.00001 sec time 500 tests is 5 milliseconds, but I count+-- about 10 seconds.+-- +-- On Linux, everything is zippy.+
unamb.cabal view
@@ -1,5 +1,5 @@ Name:                unamb-Version:             0.0+Version:             0.0.1 Cabal-Version:       >= 1.2 Synopsis:            Unambiguous choice Category:            Concurrency, Data, Other@@ -15,6 +15,8 @@   to wiki pages where you can read and contribute user comments.  Enjoy!   .   &#169; 2008 by Conal Elliott; BSD3 license.+  .+  Contributions from: Luke Palmer, Spencer Janssen Author:              Conal Elliott  Maintainer:          conal@conal.net Homepage:            http://haskell.org/haskellwiki/unamb