Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- newtype RoundRobin a = RoundRobin (IORef [a])
- newRoundRobin :: [a] -> IO (RoundRobin a)
- select :: RoundRobin a -> IO a
- set :: RoundRobin a -> [a] -> IO ()
Documentation
newtype RoundRobin a Source
A simple round-robin table useful for selecting resource using round-robin fashion.
RoundRobin (IORef [a]) |
Eq (RoundRobin a) Source |
newRoundRobin :: [a] -> IO (RoundRobin a) Source
create a round-robin table from list.
If list is empty, an error will be raised.
will use NonEmpty
in future(ghc 8 are widely used).
select :: RoundRobin a -> IO a Source
select an item from round-robin table.
set :: RoundRobin a -> [a] -> IO () Source
set a new round-robin table.