Skip to content
This repository has been archived by the owner on Apr 1, 2022. It is now read-only.

Commit

Permalink
Rename Fresh to AtomicCounter
Browse files Browse the repository at this point in the history
  • Loading branch information
cnr committed May 24, 2021
1 parent 2765734 commit 9aa8917
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 58 deletions.
4 changes: 2 additions & 2 deletions spectrometer.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ library
Control.Carrier.Diagnostics
Control.Carrier.Diagnostics.StickyContext
Control.Carrier.Finally
Control.Carrier.Fresh
Control.Carrier.AtomicCounter
Control.Carrier.Output.IO
Control.Carrier.StickyLogger
Control.Carrier.TaskPool
Expand All @@ -173,7 +173,7 @@ library
Control.Effect.ConsoleRegion
Control.Effect.Diagnostics
Control.Effect.Finally
Control.Effect.Fresh
Control.Effect.AtomicCounter
Control.Effect.Output
Control.Effect.Path
Control.Effect.Record
Expand Down
6 changes: 3 additions & 3 deletions src/App/Fossa/Analyze.hs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ import System.Exit (die, exitFailure)
import Types
import VCS.Git (fetchGitContributors)
import Control.Carrier.Diagnostics.StickyContext
import Control.Carrier.Fresh (Fresh, runFresh)
import Control.Carrier.AtomicCounter (AtomicCounter, runAtomicCounter)

data ScanDestination
= UploadScan ApiOpts ProjectMetadata -- ^ upload to fossa with provided api key and base url
Expand Down Expand Up @@ -171,7 +171,7 @@ discoverFuncs =
]

runDependencyAnalysis ::
(Has (Lift IO) sig m, Has Fresh sig m, Has Logger sig m, Has (Output ProjectResult) sig m) =>
(Has (Lift IO) sig m, Has AtomicCounter sig m, Has Logger sig m, Has (Output ProjectResult) sig m) =>
-- | Analysis base directory
BaseDir ->
[BuildTargetFilter] ->
Expand Down Expand Up @@ -216,7 +216,7 @@ analyze (BaseDir basedir) destination override unpackArchives filters = do
. runStickyLogger
. runFinally
. withTaskPool capabilities updateProgress
. runFresh
. runAtomicCounter
$ withDiscoveredProjects discoverFuncs (fromFlag UnpackArchives unpackArchives) basedir (runDependencyAnalysis (BaseDir basedir) filters)

let filteredProjects = filterProjects (BaseDir basedir) projectResults
Expand Down
4 changes: 2 additions & 2 deletions src/App/Fossa/ListTargets.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import App.Fossa.Analyze (discoverFuncs)
import App.Types (BaseDir (..))
import Control.Carrier.Diagnostics qualified as Diag
import Control.Carrier.Finally
import Control.Carrier.Fresh
import Control.Carrier.AtomicCounter
import Control.Carrier.StickyLogger (runStickyLogger, logSticky', StickyLogger)
import Control.Carrier.TaskPool
import Control.Concurrent (getNumCapabilities)
Expand All @@ -34,7 +34,7 @@ listTargetsMain (BaseDir basedir) = do
. withTaskPool capabilities updateProgress
. runReadFSIO
. runExecIO
. runFresh
. runAtomicCounter
$ do
withDiscoveredProjects discoverFuncs False basedir $ \(project :: DiscoveredProject DummyM) -> do
let maybeRel = makeRelative basedir (projectPath project)
Expand Down
4 changes: 2 additions & 2 deletions src/App/Pathfinder/Scan.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module App.Pathfinder.Scan
( scanMain
) where

import Control.Carrier.AtomicCounter (runAtomicCounter)
import Control.Carrier.Diagnostics qualified as Diag
import Control.Carrier.Error.Either
import Control.Carrier.Finally
Expand All @@ -14,7 +15,6 @@ import Control.Carrier.TaskPool
import Control.Concurrent
import Control.Effect.Exception as Exc
import Control.Effect.Lift (sendIO)
import Control.Carrier.Fresh (runFresh)
import Control.Monad (unless)
import Control.Monad.IO.Class (MonadIO)
import Data.Aeson
Expand Down Expand Up @@ -68,7 +68,7 @@ scan basedir = runFinally $ do
. runReadFSIO
. runFinally
. withTaskPool capabilities updateProgress
. runFresh
. runAtomicCounter
$ withDiscoveredProjects discoverFuncs False basedir runLicenseAnalysis

sendIO (BL.putStr (encode projectResults))
Expand Down
4 changes: 2 additions & 2 deletions src/Control/Carrier/Diagnostics/StickyContext.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import Control.Monad.Trans.Class (MonadTrans (..))
import Data.List (intersperse)
import Data.Text qualified as T
import Effect.Logger
import Control.Effect.Fresh
import Control.Effect.AtomicCounter

stickyDiag :: (Has Fresh sig m, Has (Lift IO) sig m) => StickyDiagC m a -> m a
stickyDiag :: (Has AtomicCounter sig m, Has (Lift IO) sig m) => StickyDiagC m a -> m a
stickyDiag act = do
taskId <- generateId
Sticky.withStickyRegion $ \region ->
Expand Down
29 changes: 0 additions & 29 deletions src/Control/Carrier/Fresh.hs

This file was deleted.

16 changes: 0 additions & 16 deletions src/Control/Effect/Fresh.hs

This file was deleted.

4 changes: 2 additions & 2 deletions src/Discovery/Projects.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ module Discovery.Projects (

import Control.Carrier.Diagnostics qualified as Diag
import Control.Carrier.Diagnostics.StickyContext
import Control.Effect.AtomicCounter (AtomicCounter)
import Control.Effect.Finally
import Control.Effect.Fresh
import Control.Effect.Lift
import Control.Effect.TaskPool
import Control.Monad (when)
Expand All @@ -23,7 +23,7 @@ import Types (DiscoveredProject)
-- on each discovered project. Note that the provided function is also run in
-- parallel.
withDiscoveredProjects ::
(Has Fresh sig m, Has ReadFS sig m, Has (Lift IO) sig m, Has TaskPool sig m, Has Logger sig m, Has Finally sig m) =>
(Has AtomicCounter sig m, Has ReadFS sig m, Has (Lift IO) sig m, Has TaskPool sig m, Has Logger sig m, Has Finally sig m) =>
-- | Discover functions
[Path Abs Dir -> StickyDiagC (Diag.DiagnosticsC m) [DiscoveredProject run]] ->
-- | whether to unpack archives
Expand Down

0 comments on commit 9aa8917

Please sign in to comment.