ajhc-0.8.0.8: Haskell compiler that produce binary through C language

Safe HaskellNone

Util.Once

Description

a simple type that only lets an IO action happen once, caching its result.

Synopsis

Documentation

data Once a Source

Instances

newOnce :: IO (Once a)Source

create a new Once object

runOnce :: Once a -> IO a -> IO aSource

execute the action at most once, always returning the same result

altOnce :: Once () -> IO b -> IO b -> IO bSource

run first argument once, after which perform the second

data OnceMap a b Source

run an IO action at most once for each distinct argument

Instances

runOnceMap :: Ord a => OnceMap a b -> a -> IO b -> IO bSource

altOnceMap :: Ord a => OnceMap a () -> a -> IO b -> IO b -> IO bSource

onceMapToList :: OnceMap a b -> IO [(a, b)]Source