Skip to content

Commit

Permalink
just remove all the conc stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
bristermitten committed Jul 29, 2024
1 parent 0089db6 commit 21bfd24
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 248 deletions.
7 changes: 0 additions & 7 deletions packages/polysemy-log-di/lib/Polysemy/Log/Di.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE CPP #-}
-- |Description: /polysemy-log/ adapters for /di/
module Polysemy.Log.Di (
-- * Introduction
Expand All @@ -7,19 +6,13 @@ module Polysemy.Log.Di (
-- * Interpreters
interpretLogDi,
interpretLogDi',
#ifndef mingw32_HOST_OS
interpretLogDiConc,
#endif
interpretDataLogDi,
interpretDiAtomic,
interpretDiAtomic'
) where

import Polysemy.Log.Di.Atomic (interpretDiAtomic, interpretDiAtomic')
import Polysemy.Log.Di.Di (interpretDataLogDi, interpretLogDi, interpretLogDi')
#ifndef mingw32_HOST_OS
import Polysemy.Log.Di.Di (interpretLogDiConc)
#endif
-- $intro
-- This package is a [di](https://hackage.haskell.org/package/di-polysemy) adapter for
-- [polysemy-log](https://hackage.haskell.org/package/polysemy-log), providing interpreters that convert
Expand Down
23 changes: 2 additions & 21 deletions packages/polysemy-log-di/lib/Polysemy/Log/Di/Di.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
module Polysemy.Log.Di.Di where

import qualified DiPolysemy as Di
#ifndef mingw32_HOST_OS
import Polysemy.Conc (Race)
#endif

import Polysemy.Internal.Tactics (liftT)
import Polysemy.Time (GhcTime)

Expand All @@ -17,9 +15,6 @@ import Polysemy.Log.Data.Severity (Severity)
import Polysemy.Log.Effect.DataLog (DataLog (DataLog, Local))
import Polysemy.Log.Effect.Log (Log)
import Polysemy.Log.Log (interpretLogDataLog, interpretLogDataLog')
#ifndef mingw32_HOST_OS
import Polysemy.Log.Log (interpretLogDataLogConc)
#endif

-- |Reinterpret 'DataLog' as 'Di.Di', using the provided function to extract the log level from the message.
-- Maintains a context function as state that is applied to each logged message, allowing the context of a block to be
Expand Down Expand Up @@ -72,18 +67,4 @@ interpretLogDi' =
interpretLogDataLog' .
raiseUnder .
raise2Under
{-# inline interpretLogDi' #-}

#ifndef mingw32_HOST_OS
-- |Reinterpret 'Log' as 'Di.Di' concurrently.
interpretLogDiConc ::
path r .
Members [Di.Di Severity path (LogEntry LogMessage), Resource, Async, Race, Embed IO] r =>
Int ->
InterpreterFor Log r
interpretLogDiConc maxQueued =
interpretDataLogDi @_ @path @(LogEntry LogMessage) (\ m -> m.message.severity) .
interpretLogDataLogConc maxQueued .
raiseUnder
{-# inline interpretLogDiConc #-}
#endif
{-# inline interpretLogDi' #-}
3 changes: 0 additions & 3 deletions packages/polysemy-log-di/polysemy-log-di.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ library
, polysemy-log >=0.10.0.1 && <0.11
, polysemy-time ==0.6.*
, stm
if !os(windows)
build-depends:
polysemy-conc >=0.12 && <0.14
mixins:
base hiding (Prelude)
, incipit-core (IncipitCore as Prelude)
Expand Down
37 changes: 3 additions & 34 deletions packages/polysemy-log/lib/Polysemy/Log.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{-# language NoImplicitPrelude #-}
{-# language CPP #-}
{-# options_haddock prune #-}

{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_HADDOCK prune #-}

-- |Description: Polysemy Effects for Logging
module Polysemy.Log (
Expand Down Expand Up @@ -44,19 +44,11 @@ module Polysemy.Log (
-- ** Interpreters
interpretLogStderrWith,
interpretLogStderrLevelWith,
#ifndef mingw32_HOST_OS
interpretLogStderrConc,
interpretLogStderrLevelConc,
#endif
interpretLogStderr,
interpretLogStderrLevel,
interpretLogStderr',
interpretLogStdoutWith,
interpretLogStdoutLevelWith,
#ifndef mingw32_HOST_OS
interpretLogStdoutConc,
interpretLogStdoutLevelConc,
#endif
interpretLogStdout,
interpretLogStdoutLevel,
interpretLogStdout',
Expand All @@ -67,17 +59,9 @@ module Polysemy.Log (
interpretLogAtomic,
interpretLogAtomic',

#ifndef mingw32_HOST_OS
-- * Concurrent Logging
interceptDataLogConc,
interpretLogDataLogConc,
#endif
) where

import Polysemy.Log.Atomic (interpretDataLogAtomic, interpretDataLogAtomic', interpretLogAtomic, interpretLogAtomic')
#ifndef mingw32_HOST_OS
import Polysemy.Log.Conc (interceptDataLogConc)
#endif
import Polysemy.Log.Effect.DataLog (DataLog (DataLog), Logger, dataLog, local)
import Polysemy.Log.Effect.Log (Log (Log), crit, debug, error, info, log, trace, warn)
import Polysemy.Log.Data.LogEntry (LogEntry (LogEntry))
Expand All @@ -89,23 +73,14 @@ import Polysemy.Log.Log (
interpretDataLog,
interpretLogDataLog,
interpretLogDataLog',
#ifndef mingw32_HOST_OS
interpretLogDataLogConc,
#endif
)
import Polysemy.Log.Pure (interpretLogNull, interpretLogOutput)
import Polysemy.Log.Stderr (
interpretDataLogStderr,
interpretDataLogStderrWith,
interpretLogStderr,
interpretLogStderr',
#ifndef mingw32_HOST_OS
interpretLogStderrConc,
#endif
interpretLogStderrLevel,
#ifndef mingw32_HOST_OS
interpretLogStderrLevelConc,
#endif
interpretLogStderrLevelWith,
interpretLogStderrWith,
)
Expand All @@ -114,13 +89,7 @@ import Polysemy.Log.Stdout (
interpretDataLogStdoutWith,
interpretLogStdout,
interpretLogStdout',
#ifndef mingw32_HOST_OS
interpretLogStdoutConc,
#endif
interpretLogStdoutLevel,
#ifndef mingw32_HOST_OS
interpretLogStdoutLevelConc,
#endif
interpretLogStdoutLevelWith,
interpretLogStdoutWith,
)
Expand Down
93 changes: 0 additions & 93 deletions packages/polysemy-log/lib/Polysemy/Log/Conc.hs

This file was deleted.

23 changes: 1 addition & 22 deletions packages/polysemy-log/lib/Polysemy/Log/Log.hs
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
{-# LANGUAGE CPP #-}
-- |Description: Internal
module Polysemy.Log.Log where

#ifndef mingw32_HOST_OS
import Polysemy.Conc (Race)
#endif

import Polysemy.Internal.Tactics (liftT)
import Polysemy.Time (GhcTime, interpretTimeGhc)

#ifndef mingw32_HOST_OS
import Polysemy.Log.Conc (interceptDataLogConc)
#endif
import Polysemy.Log.Effect.DataLog (DataLog (DataLog, Local), dataLog)
import Polysemy.Log.Effect.Log (Log (Log))
import Polysemy.Log.Data.LogEntry (LogEntry, annotate)
Expand Down Expand Up @@ -66,21 +60,6 @@ interpretLogDataLog' =
interpretLogMetadataDataLog' . interpretLogLogMetadata
{-# inline interpretLogDataLog' #-}

#ifndef mingw32_HOST_OS
-- |Interpret 'Log' into 'DataLog' concurrently, adding metadata information and wrapping with 'LogEntry'.
interpretLogDataLogConc ::
Members [DataLog (LogEntry LogMessage), Resource, Async, Race, Embed IO] r =>
Int ->
InterpreterFor Log r
interpretLogDataLogConc maxQueued =
interceptDataLogConc @(LogEntry LogMessage) maxQueued .
interpretTimeGhc .
interpretLogMetadataDataLog @LogMessage .
interpretLogLogMetadata .
raiseUnder2
{-# inline interpretLogDataLogConc #-}
#endif

-- |Helper for maintaining a context function as state that is applied to each logged message, allowing the context of a
-- block to be modified.
interpretDataLogLocal ::
Expand Down
34 changes: 1 addition & 33 deletions packages/polysemy-log/lib/Polysemy/Log/Stderr.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
-- |Description: Stderr Interpreters, Internal
module Polysemy.Log.Stderr where

#ifndef mingw32_HOST_OS
import Polysemy.Conc (Race)
#endif

import Polysemy.Time (GhcTime, interpretTimeGhc)
import System.IO (stderr)

Expand All @@ -17,9 +15,6 @@ import Polysemy.Log.Format (formatLogEntry)
import Polysemy.Log.Handle (interpretDataLogHandleWith)
import Polysemy.Log.Level (setLogLevel)
import Polysemy.Log.Log (interpretLogDataLog)
#ifndef mingw32_HOST_OS
import Polysemy.Log.Log (interpretLogDataLogConc)
#endif

-- |Interpret 'DataLog' by printing to stderr, converting messages to 'Text' with the supplied function.
interpretDataLogStderrWith ::
Expand Down Expand Up @@ -96,30 +91,3 @@ interpretLogStderr' =
interpretLogStderr .
raiseUnder
{-# inline interpretLogStderr' #-}

#ifndef mingw32_HOST_OS
-- |Like 'interpretLogStderr', but process messages concurrently.
interpretLogStderrConc ::
Members [Resource, Async, Race, Embed IO] r =>
InterpreterFor Log r
interpretLogStderrConc =
interpretTimeGhc .
interpretDataLogStderrWith formatLogEntry .
interpretLogDataLogConc 64 .
raiseUnder2
{-# inline interpretLogStderrConc #-}

-- |Like 'interpretLogStderr', but process messages concurrently.
interpretLogStderrLevelConc ::
Members [Resource, Async, Race, Embed IO] r =>
Maybe Severity ->
InterpreterFor Log r
interpretLogStderrLevelConc level =
interpretTimeGhc .
interpretDataLogStderrWith formatLogEntry .
setLogLevel level .
interpretLogDataLogConc 64 .
raiseUnder2
{-# inline interpretLogStderrLevelConc #-}

#endif
Loading

0 comments on commit 21bfd24

Please sign in to comment.