diff options
Diffstat (limited to 'lazy.hs')
-rw-r--r-- | lazy.hs | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -0,0 +1,30 @@ | |||
1 | {-# LANGUAGE NoMonomorphismRestriction #-} | ||
2 | import Control.Monad.ST | ||
3 | import Control.Monad.ST.Unsafe | ||
4 | import Data.VCDIFF | ||
5 | import qualified Data.ByteString as B | ||
6 | |||
7 | step2 = undefined | ||
8 | |||
9 | step1 = do | ||
10 | xs <- unsafeInterleaveST $ step2 | ||
11 | return $ 3 : xs | ||
12 | |||
13 | test f = do | ||
14 | xs <- f $ step2 | ||
15 | return $ 3 : xs | ||
16 | |||
17 | test2 f = withByteString B.empty $ \_ _ -> do | ||
18 | xs <- f $ step2 | ||
19 | return $ 3 : xs | ||
20 | |||
21 | main = do | ||
22 | let xs = runST step1 | ||
23 | ys = runST (test id) | ||
24 | zs = runST (test unsafeInterleaveST) | ||
25 | vs = runST (test2 unsafeInterleaveST) | ||
26 | print $ take 1 xs | ||
27 | -- print $ take 1 ys | ||
28 | print $ take 1 zs | ||
29 | print $ take 1 vs | ||
30 | |||