cli-utils-4.1.0
LicenseBSD3
Maintainertbidne@gmail.com
Safe HaskellTrustworthy
LanguageHaskell2010

Git.Stale.Core.MonadFindBranches

Description

The MonadFindBranches class.

Synopsis

Documentation

class Monad m => MonadFindBranches m where Source #

The MonadFindBranches class is used to describe various git actions for finding stale branches.

Associated Types

type Handler (m :: Type -> Type) (a :: Type) Source #

Adds custom handling to returned data (e.g. for error handling).

type FinalResults m :: Type Source #

The type returned by collectResults.

Methods

branchNamesByGrep :: Maybe FilePath -> BranchType -> Maybe Text -> m [Handler m Name] Source #

Returns a [Name] representing git branches.

getStaleLogs :: Maybe FilePath -> RNonNegative Int -> Day -> [Handler m Name] -> m (Filtered (Handler m NameAuthDay)) Source #

Maps [Name] to [NameAuthDay], filtering out non-stale branches.

toBranches :: Maybe FilePath -> Text -> Filtered (Handler m NameAuthDay) -> m [Handler m AnyBranch] Source #

Maps [NameAuthDay] to [AnyBranch].

collectResults :: [Handler m AnyBranch] -> m (FinalResults m) Source #

Collects [AnyBranch] into FinalResults.

display :: Text -> FinalResults m -> m () Source #

Displays results.

Instances

Instances details
MonadFindBranches IO Source #

MonadFindBranches instance IO. This means we can encounter exceptions, but

  • We do not want a single exception trying to parse one branch kill the entire program.
  • We do not want to ignore problems entirely.

We collect the results in ResultsWithErrs, which contains a list of errors and two maps, one for merged branches and another for unmerged branches. We opt to define Handler as (ErrOr a) -- an alias for (Either Err a) -- as we do not want a single error to crash the app. instance (MonadLogger m, R.MonadIO m) => MonadFindBranches (AppT Env m) where

Instance details

Defined in Git.Stale.Core.MonadFindBranches

Associated Types

type Handler IO a Source #

type FinalResults IO Source #

MonadFindBranches m => MonadFindBranches (AppT Env m) Source # 
Instance details

Defined in Git.Stale.Core.MonadFindBranches

Associated Types

type Handler (AppT Env m) a Source #

type FinalResults (AppT Env m) Source #

runFindBranches :: (MonadReader Env m, MonadFindBranches m) => m () Source #

High level logic of MonadFindBranches usage. This function is the entrypoint for any MonadFindBranches instance.