diff options
Diffstat (limited to 'ch24/test_24_a_2.hs')
| -rw-r--r-- | ch24/test_24_a_2.hs | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/ch24/test_24_a_2.hs b/ch24/test_24_a_2.hs new file mode 100644 index 0000000..2968d9c --- /dev/null +++ b/ch24/test_24_a_2.hs @@ -0,0 +1,69 @@ +import Module_24_a_2 +--import Control.Concurrent -- Non-strict versions + + +-- Test: The type constructors are accessible +-- mTypeConstructorAccessible :: IO (StrictMVar Int) +-- mTypeConstructorAccessible = newStrictEmptyMVar + +-- cTypeConstructorAccessible :: IO (StrictChan Char) +-- cTypeConstructorAccessible = newStrictChan + + +-- Test: The data constructors are not accessible +-- mDataConstructorNotAccessible :: StrictMVar Int +-- mDataConstructorNotAccessible x = case x of +-- StrictM j -> undefined + +-- cDataConstructorNotAccessible :: StrictChan Int +-- cDataConstructorNotAccessible x = case x of +-- StrictC j -> undefined + + +-- Test: It is not possible to change the import from the strict versions to +-- non-strict ones with this test still compiling +-- mStrict = do +-- x <- newStrictEmptyMVar +-- putMVar x 1 +-- v <- takeMVar x +-- putStrLn $ show v + +-- cStrict = do +-- x <- newStrictChan +-- writeChan x 2 +-- v <- readChan x +-- putStrLn $ show v + + +-- Test: The non-strict versions do not evalute the value before placing it into +-- MVar or Chan +-- m1NonStrict = do +-- x <- newEmptyMVar +-- putMVar x undefined +-- return () + +-- m2NonStrict = do +-- x <- newMVar undefined +-- return () + +-- cNonStrict = do +-- x <- newChan +-- writeChan x undefined +-- return () + + +-- Test: The strict versions evalute the value before placing it into MVar or +-- Chan +-- m1Strict = do +-- x <- newStrictEmptyMVar +-- putMVar x undefined +-- return () + +-- m2Strict = do +-- x <- newStrictMVar undefined +-- return () + +-- cStrict = do +-- x <- newStrictChan +-- writeChan x undefined +-- return () |
