| License | BSD3 |
|---|---|
| Maintainer | tbidne@gmail.com |
| Safe Haskell | None |
| Language | Haskell2010 |
Git.Stale.Core.Internal
Description
Exports utility functions mainly for parsing/transforming between types/errors.
Synopsis
- badBranch :: Text -> Bool
- exceptToErr :: Show a => Either a (Either Err b) -> Either Err b
- parseLog :: NameLog -> ErrOr NameAuthDay
- parseAuthDateStr :: NameLog -> ErrOr NameAuthDateStr
- parseDay :: NameAuthDateStr -> ErrOr NameAuthDay
- safeRead :: Text -> ErrOr Int
- stale :: RNonNegative Int -> Day -> NameAuthDay -> Bool
- staleNonErr :: RNonNegative Int -> Day -> ErrOr NameAuthDay -> Bool
- textToName :: Text -> ErrOr Name
- unsafeToInt :: Text -> Int
Documentation
parseLog :: NameLog -> ErrOr NameAuthDay Source #
Parses NameLog into NameAuthDay, recording errors
as ErrOr.
parseAuthDateStr :: NameLog -> ErrOr NameAuthDateStr Source #
Intermediate parsing of NameLog into NameAuthDateStr,
recording errors as ErrOr.
parseDay :: NameAuthDateStr -> ErrOr NameAuthDay Source #
Intermediate parsing of NameAuthDateStr into NameAuthDay,
recording errors as ErrOr.
stale :: RNonNegative Int -> Day -> NameAuthDay -> Bool Source #
Determines if NameAuthDay is stale given by
stale lim day (_, _, d) <=> day - d >= lim
staleNonErr :: RNonNegative Int -> Day -> ErrOr NameAuthDay -> Bool Source #
For Right NameAuthDay, behaves the same as stale.
But for Left Err it is always true, since we do not want
to filter out errors.
textToName :: Text -> ErrOr Name Source #
Strips whitespace and potential git prefix (i.e. remotes/). Works for strings with no prefix and those that have the prefix exactly once, e.g.
textToName "branch" -> branch textToName "remotes/origin/branch" -> origin/branch textToName "blah/remotes/origin/branch" -> origin/branch
Returns Left ParseName if the prefix occurs more than once as we
have definitely entered undefined territory.