-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Statistics visualizer for org-mode
--
-- Statistics visualizer for org-mode
@package orgstat
@version 0.1.0
-- | Different utilities
module OrgStat.Util
-- | JSON/Yaml TH modifier. Each field of type "aoeuKek" turns into "kek".
-- Placed here because it can't be defined near json TH deriving (ghc
-- restriction).
dropLowerOptions :: Options
-- | Drops n items from the end.
dropEnd :: Int -> [x] -> [x]
-- | Same as addUTCTime, but for local
addLocalTime :: (Integral n) => n -> LocalTime -> LocalTime
fromJustM :: Monad m => m b -> m (Maybe b) -> m b
-- | Parses colour from format '#rrggbb' or just rrggbb
parseColour :: forall s a. (ToString s, Floating a, Ord a) => s -> Maybe (Colour a)
-- | Generates a colour given salt and anything hashable. Doesn't return
-- too dark or too light colors.
hashColour :: (Hashable a) => Int -> a -> Colour Double
-- | Maybe setter that does nothing on Nothing.
(??~) :: ASetter s s a b -> Maybe b -> s -> s
-- | Time formatter in form HH:MM
timeF :: NominalDiffTime -> Text
-- | Types common among reports.
module OrgStat.Outputs.Types
data TimelineParams
TimelineParams :: !Int -> !Bool -> !Int -> !Double -> !Double -> !(Colour Double) -> TimelineParams
-- | Salt added when getting color out of task name.
[_tpColorSalt] :: TimelineParams -> !Int
-- | Include map legend?
[_tpLegend] :: TimelineParams -> !Bool
-- | How many items to include in top day (under column)
[_tpTopDay] :: TimelineParams -> !Int
-- | Column width in percent
[_tpColumnWidth] :: TimelineParams -> !Double
-- | Column height
[_tpColumnHeight] :: TimelineParams -> !Double
-- | Color of background
[_tpBackground] :: TimelineParams -> !(Colour Double)
tpColorSalt :: Lens' TimelineParams Int
tpLegend :: Lens' TimelineParams Bool
tpTopDay :: Lens' TimelineParams Int
tpColumnWidth :: Lens' TimelineParams Double
tpColumnHeight :: Lens' TimelineParams Double
tpBackground :: Lens' TimelineParams (Colour Double)
-- | SVG timeline image.
newtype TimelineOutput
TimelineOutput :: (Diagram B) -> TimelineOutput
-- | Parameters of the summary output
data SummaryParams
SummaryParams :: !Text -> SummaryParams
-- | Formatting template.
[spTemplate] :: SummaryParams -> !Text
-- | Some text (supposed to be single line or something).
newtype SummaryOutput
SummaryOutput :: Text -> SummaryOutput
-- | Parameters for block output. Stub (for now).
data BlockParams
BlockParams :: BlockParams
-- | Output of block type is text file, basically.
newtype BlockOutput
BlockOutput :: Text -> BlockOutput
instance GHC.Show.Show OrgStat.Outputs.Types.BlockParams
instance GHC.Show.Show OrgStat.Outputs.Types.SummaryParams
instance GHC.Base.Monoid OrgStat.Outputs.Types.TimelineParams
instance GHC.Show.Show OrgStat.Outputs.Types.TimelineParams
instance Data.Default.Class.Default OrgStat.Outputs.Types.TimelineParams
-- | Common things among reports
module OrgStat.Outputs.Class
-- | Things that reporters output an what we can do with them.
class ReportOutput a
-- | Writes report to the disk, given path to file.
writeReport :: (ReportOutput a, MonadIO m) => FilePath -> a -> m ()
instance OrgStat.Outputs.Class.ReportOutput OrgStat.Outputs.Types.TimelineOutput
instance OrgStat.Outputs.Class.ReportOutput OrgStat.Outputs.Types.SummaryOutput
instance OrgStat.Outputs.Class.ReportOutput OrgStat.Outputs.Types.BlockOutput
-- | Common args and parser.
module OrgStat.CLI
-- | Read-only arguments that inner application needs (in contrast to, say,
-- logging severity).
data CommonArgs
CommonArgs :: !Bool -> !(Maybe Text) -> !(Maybe FilePath) -> CommonArgs
-- | Open report types using xdg-open
[xdgOpen] :: CommonArgs -> !Bool
-- | Single output can be selected instead of running all of them.
[selectOutput] :: CommonArgs -> !(Maybe Text)
-- | Output directory for all ... outputs.
[outputDir] :: CommonArgs -> !(Maybe FilePath)
parseCommonArgs :: Parser CommonArgs
instance GHC.Show.Show OrgStat.CLI.CommonArgs
-- | Abstract syntax tree for org.
module OrgStat.Ast
-- | Org clock representation -- a pair of time in UTC. Should be local
-- time in fact, but we'll assume that UTC timestamps support in org will
-- be added at some point. For now all tags are to be read in local time.
data Clock
Clock :: LocalTime -> LocalTime -> Clock
[cFrom] :: Clock -> LocalTime
[cTo] :: Clock -> LocalTime
-- | Main datatype of org AST. It may contain some metadata if needed (e.g.
-- current node depth, children number etc). Content of headers is
-- ignored.
data Org
Org :: Text -> [Text] -> [Clock] -> [Org] -> Org
[_orgTitle] :: Org -> Text
[_orgTags] :: Org -> [Text]
[_orgClocks] :: Org -> [Clock]
[_orgSubtrees] :: Org -> [Org]
orgTitle :: Lens' Org Text
orgTags :: Lens' Org [Text]
orgClocks :: Lens' Org [Clock]
orgSubtrees :: Lens' Org [Org]
clockDuration :: Clock -> NominalDiffTime
-- | Calculate total clocks duration in org tree.
orgTotalDuration :: Org -> NominalDiffTime
-- | Remove subtrees that have zero total duration.
filterHasClock :: Org -> Org
cutFromTo :: (LocalTime, LocalTime) -> Org -> Org
-- | Functor-like fmap on field chosen by lens.
fmapOrgLens :: ASetter' Org a -> (a -> a) -> Org -> Org
-- | Traverses node and subnodes, all recursively. Bottom-top.
traverseTree :: Traversal' Org Org
atDepth :: Int -> Traversal' Org Org
-- | Merges task clocks that have less then 2m delta between them into one.
mergeClocks :: Org -> Org
instance GHC.Classes.Eq OrgStat.Ast.Org
instance GHC.Show.Show OrgStat.Ast.Org
instance GHC.Classes.Ord OrgStat.Ast.Clock
instance GHC.Classes.Eq OrgStat.Ast.Clock
instance GHC.Show.Show OrgStat.Ast.Clock
-- | Block output similar to default org reporting. This is stub version
-- which is to be improved later.
module OrgStat.Outputs.Block
genBlockOutput :: BlockParams -> Org -> BlockOutput
-- | Timeline reporting output. Prouces a svg with columns.
module OrgStat.Outputs.Timeline
processTimeline :: TimelineParams -> Org -> TimelineOutput
-- | Org-mode format parsing.
module OrgStat.Parser
data ParsingException
ParsingException :: Text -> ParsingException
parseOrg :: [Text] -> Parser Org
runParser :: (MonadThrow m) => [Text] -> Text -> m Org
instance GHC.Show.Show OrgStat.Parser.ParsingException
instance GHC.Exception.Exception OrgStat.Parser.ParsingException
-- | This module defines how report input is formed.
module OrgStat.Scope
-- | Path in org AST is just a list of paths, head ~ closer to tree root.
newtype AstPath
AstPath :: [Text] -> AstPath
[getAstPath] :: AstPath -> [Text]
isSubPath :: AstPath -> AstPath -> Bool
-- | Checks if something is on that path in given Org.
existsPath :: AstPath -> Org -> Bool
-- | Modificicators of org tree. They remove some subtrees
data ScopeModifier
-- | Turns all subtrees starting with path and then on depth
-- d into leaves.
ModPruneSubtree :: AstPath -> Int -> ScopeModifier
-- | Given text tag name, it leaves only those subtrees that have this tag
-- (tags are inherited).
ModFilterTag :: Text -> ScopeModifier
-- | Starting at node on path A and depth n, turn A into set of nodes
-- Aa1a2...an. Doesn't work/make sense for empty path.
ModSquash :: AstPath -> ScopeModifier
-- | Leaves only node at path, deletes all other subtrees.
ModSelectSubtree :: AstPath -> ScopeModifier
-- | Generates an org to be processed by report generators from
-- Scope.
applyModifiers :: Org -> [ScopeModifier] -> Either ModifierError Org
instance GHC.Show.Show OrgStat.Scope.ModifierError
instance GHC.Classes.Ord OrgStat.Scope.ScopeModifier
instance GHC.Classes.Eq OrgStat.Scope.ScopeModifier
instance GHC.Show.Show OrgStat.Scope.ScopeModifier
instance GHC.Classes.Ord OrgStat.Scope.AstPath
instance GHC.Classes.Eq OrgStat.Scope.AstPath
instance GHC.Show.Show OrgStat.Scope.AstPath
instance GHC.Exception.Exception OrgStat.Scope.ModifierError
-- | Configuration file types, together with json instances.
module OrgStat.Config
-- | Exception type for everything bad that happens with config, starting
-- from parsing to logic errors.
data ConfigException
ConfigParseException :: Text -> ConfigException
ConfigLogicException :: Text -> ConfigException
data ConfDate
ConfNow :: ConfDate
ConfLocal :: !LocalTime -> ConfDate
data ConfRange
ConfFromTo :: !ConfDate -> !ConfDate -> ConfRange
ConfBlockWeek :: !Integer -> ConfRange
ConfBlockDay :: !Integer -> ConfRange
ConfBlockMonth :: !Integer -> ConfRange
data ConfOutputType
TimelineOutput :: !TimelineParams -> !Text -> ConfOutputType
[toParams] :: ConfOutputType -> !TimelineParams
[toReport] :: ConfOutputType -> !Text
SummaryOutput :: !SummaryParams -> ConfOutputType
BlockOutput :: !BlockParams -> !Text -> ConfOutputType
[boParams] :: ConfOutputType -> !BlockParams
[boReport] :: ConfOutputType -> !Text
data ConfOutput
ConfOutput :: !ConfOutputType -> !Text -> ConfOutput
[coType] :: ConfOutput -> !ConfOutputType
[coName] :: ConfOutput -> !Text
data ConfScope
ConfScope :: !Text -> !(NonEmpty FilePath) -> ConfScope
[csName] :: ConfScope -> !Text
[csPaths] :: ConfScope -> !(NonEmpty FilePath)
data ConfReport
ConfReport :: !Text -> !Text -> !ConfRange -> ![ScopeModifier] -> ConfReport
[crName] :: ConfReport -> !Text
[crScope] :: ConfReport -> !Text
[crRange] :: ConfReport -> !ConfRange
[crModifiers] :: ConfReport -> ![ScopeModifier]
data OrgStatConfig
OrgStatConfig :: ![ConfScope] -> ![ConfReport] -> ![ConfOutput] -> !TimelineParams -> ![Text] -> !FilePath -> !Int -> OrgStatConfig
[confScopes] :: OrgStatConfig -> ![ConfScope]
[confReports] :: OrgStatConfig -> ![ConfReport]
[confOutputs] :: OrgStatConfig -> ![ConfOutput]
[confBaseTimelineParams] :: OrgStatConfig -> !TimelineParams
[confTodoKeywords] :: OrgStatConfig -> ![Text]
[confOutputDir] :: OrgStatConfig -> !FilePath
[confColorSalt] :: OrgStatConfig -> !Int
instance GHC.Show.Show OrgStat.Config.OrgStatConfig
instance GHC.Show.Show OrgStat.Config.ConfReport
instance GHC.Show.Show OrgStat.Config.ConfOutput
instance GHC.Show.Show OrgStat.Config.ConfScope
instance GHC.Show.Show OrgStat.Config.ConfOutputType
instance GHC.Show.Show OrgStat.Config.ConfRange
instance GHC.Show.Show OrgStat.Config.ConfDate
instance GHC.Show.Show OrgStat.Config.ConfigException
instance GHC.Exception.Exception OrgStat.Config.ConfigException
instance Data.Aeson.Types.FromJSON.FromJSON OrgStat.Scope.AstPath
instance Data.Aeson.Types.FromJSON.FromJSON OrgStat.Scope.ScopeModifier
instance Data.Aeson.Types.FromJSON.FromJSON OrgStat.Config.ConfDate
instance Data.Aeson.Types.FromJSON.FromJSON OrgStat.Config.ConfRange
instance Data.Aeson.Types.FromJSON.FromJSON OrgStat.Outputs.Types.TimelineParams
instance Data.Aeson.Types.FromJSON.FromJSON OrgStat.Config.ConfOutputType
instance Data.Aeson.Types.FromJSON.FromJSON OrgStat.Config.ConfOutput
instance Data.Aeson.Types.FromJSON.FromJSON OrgStat.Config.ConfScope
instance Data.Aeson.Types.FromJSON.FromJSON OrgStat.Config.ConfReport
instance Data.Aeson.Types.FromJSON.FromJSON OrgStat.Config.OrgStatConfig
-- | Operations with files mostly.
module OrgStat.IO
-- | Attempts to read a file. If extension is ".gpg", asks a user to
-- decrypt it first. Returns a pair (filename, content). It also
-- takes a list of TODO-keywords to take header names correctly.
readOrgFile :: (MonadIO m, MonadCatch m, WithLogger m) => [Text] -> FilePath -> m (Text, Org)
-- | Reads yaml config
readConfig :: (MonadIO m, MonadThrow m) => FilePath -> m OrgStatConfig
instance GHC.Show.Show OrgStat.IO.OrgIOException
instance GHC.Exception.Exception OrgStat.IO.OrgIOException
-- | Definition for main work scope
module OrgStat.WorkMonad
-- | Read-only app configuration.
data WorkConfig
WorkConfig :: OrgStatConfig -> CommonArgs -> WorkConfig
[_wcConfig] :: WorkConfig -> OrgStatConfig
[_wcCommonArgs] :: WorkConfig -> CommonArgs
wcConfig :: Lens' WorkConfig OrgStatConfig
wcCommonArgs :: Lens' WorkConfig CommonArgs
-- | State component of application.
data WorkData
wdReadFiles :: Lens' WorkData (HashMap FilePath (Text, Org))
wdResolvedScopes :: Lens' WorkData (HashMap Text Org)
wdResolvedReports :: Lens' WorkData (HashMap Text Org)
newtype WorkM a
WorkM :: StateT WorkData (ReaderT WorkConfig IO) a -> WorkM a
[getWorkM] :: WorkM a -> StateT WorkData (ReaderT WorkConfig IO) a
runWorkM :: MonadIO m => WorkConfig -> WorkM a -> m a
instance Control.Monad.Catch.MonadCatch OrgStat.WorkMonad.WorkM
instance Control.Monad.Catch.MonadThrow OrgStat.WorkMonad.WorkM
instance System.Wlog.CanLog.CanLog OrgStat.WorkMonad.WorkM
instance Control.Monad.State.Class.MonadState OrgStat.WorkMonad.WorkData OrgStat.WorkMonad.WorkM
instance Control.Monad.Reader.Class.MonadReader OrgStat.WorkMonad.WorkConfig OrgStat.WorkMonad.WorkM
instance Control.Monad.IO.Class.MonadIO OrgStat.WorkMonad.WorkM
instance GHC.Base.Monad OrgStat.WorkMonad.WorkM
instance GHC.Base.Applicative OrgStat.WorkMonad.WorkM
instance GHC.Base.Functor OrgStat.WorkMonad.WorkM
instance Data.Default.Class.Default OrgStat.WorkMonad.WorkData
instance System.Wlog.LoggerNameBox.HasLoggerName OrgStat.WorkMonad.WorkM
-- | Different logic-related components.
module OrgStat.Helpers
-- | Converts config range to a pair of UTCTime, right bound not
-- inclusive.
convertRange :: (MonadIO m) => ConfRange -> m (LocalTime, LocalTime)
-- | Resolves org file: reads from path and puts into state or just gets
-- out of state if was read before.
resolveInputOrg :: FilePath -> WorkM (Text, Org)
-- | Return scope with requested name or fail. It will be either
-- constructed on the spot or taken from the state if it had been created
-- previously.
resolveScope :: Text -> WorkM Org
-- | Same as resolveScope but related to reports.
resolveReport :: Text -> WorkM Org
resolveOutput :: Text -> WorkM ConfOutput
-- | Summary output type.
module OrgStat.Outputs.Summary
-- | Generates summary using provided params.
genSummaryOutput :: SummaryParams -> WorkM SummaryOutput
instance GHC.Show.Show OrgStat.Outputs.Summary.InputToken
-- | Re-exporting output functionality
module OrgStat.Outputs
-- | Main logic combining all components
module OrgStat.Logic
-- | Main application logic.
runOrgStat :: WorkM ()