module TimerWheel.Internal.Config
  ( Config (..),
  )
where

import Data.Fixed (E6, Fixed)
import GHC.Generics (Generic)

-- | Timer wheel config.
--
-- * @spokes@ must be ∈ @[1, maxBound]@
-- * @resolution@ must ∈ @(0, ∞]@
data Config = Config
  { -- | Spoke count.
    Config -> Int
spokes :: {-# UNPACK #-} !Int,
    -- | Resolution, in seconds.
    Config -> Fixed E6
resolution :: !(Fixed E6)
  }
  deriving stock (forall x. Rep Config x -> Config
forall x. Config -> Rep Config x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Config x -> Config
$cfrom :: forall x. Config -> Rep Config x
Generic, Int -> Config -> ShowS
[Config] -> ShowS
Config -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Config] -> ShowS
$cshowList :: [Config] -> ShowS
show :: Config -> String
$cshow :: Config -> String
showsPrec :: Int -> Config -> ShowS
$cshowsPrec :: Int -> Config -> ShowS
Show)