packages feed

unclogging-0.1.0.1: src/Control/Effect/Unclog.hs

module Control.Effect.Unclog (Log (..), publishLogEntry) where

import Chronos.Types (Time)
import Control.Algebra (Has, send)
import Unclog.Common (LogEntry)

-- | a logging effect
data Log m r where
  PublishLogEntry :: (Time -> LogEntry) -> Log m ()

-- | publish a log entry that gets supplied a time by the effect interpretation
publishLogEntry :: Has Log sig m => (Time -> LogEntry) -> m ()
publishLogEntry = send . PublishLogEntry
{-# INLINE publishLogEntry #-}