File: IORef.hs

package info (click to toggle)
haskell-fast-logger 2.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 84 kB
  • ctags: 1
  • sloc: haskell: 324; makefile: 3
file content (19 lines) | stat: -rw-r--r-- 413 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{-# LANGUAGE CPP #-}

module System.Log.FastLogger.IORef (
       IORef
     , newIORef
     , readIORef
     , atomicModifyIORef'
     ) where

import Data.IORef

#if !MIN_VERSION_base(4, 6, 0)
atomicModifyIORef' :: IORef a -> (a -> (a,b)) -> IO b
atomicModifyIORef' ref f = do
    b <- atomicModifyIORef ref
            (\x -> let (a, b) = f x
                    in (a, a `seq` b))
    b `seq` return b
#endif