-- 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.0.2 -- | Definition for main work scope module OrgStat.WorkMonad data WorkScope WorkScope :: FilePath -> Bool -> WorkScope [_wConfigFile] :: WorkScope -> FilePath [_wXdgOpen] :: WorkScope -> Bool wConfigFile :: Lens' WorkScope FilePath wXdgOpen :: Lens' WorkScope Bool newtype WorkM a WorkM :: ReaderT WorkScope IO a -> WorkM a [getWorkM] :: WorkM a -> ReaderT WorkScope IO a runWorkM :: MonadIO m => WorkScope -> 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.Reader.Class.MonadReader OrgStat.WorkMonad.WorkScope 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 System.Wlog.LoggerNameBox.HasLoggerName OrgStat.WorkMonad.WorkM -- | 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 -- | Types common among reports. module OrgStat.Report.Types data SVGImageReport SVGImage :: (Diagram B) -> SVGImageReport -- | Common things among reports module OrgStat.Report.Class -- | Things that reporters output an what we can do with them. class Report a -- | Writes report to the disk, given directory and filename. writeReport :: (Report a, MonadIO m) => FilePath -> FilePath -> a -> m () instance OrgStat.Report.Class.Report OrgStat.Report.Types.SVGImageReport -- | 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] -- | Functor-like fmap on field chosen by lens. fmapOrgLens :: ASetter' Org a -> (a -> a) -> Org -> Org -- | Traverses node and subnodes, all recursively 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 -- | 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 -- | Timeline reporting. Prouces a svg with columns. module OrgStat.Report.Timeline 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) processTimeline :: (MonadThrow m) => TimelineParams -> Org -> (LocalTime, LocalTime) -> m SVGImageReport instance GHC.Base.Monoid OrgStat.Report.Timeline.TimelineParams instance GHC.Show.Show OrgStat.Report.Timeline.TimelineParams instance Data.Default.Class.Default OrgStat.Report.Timeline.TimelineParams -- | Re-exporting report functionality module OrgStat.Report -- | 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 inherit). 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 ConfReportType Timeline :: !ConfRange -> !Text -> !TimelineParams -> ConfReportType [timelineRange] :: ConfReportType -> !ConfRange [timelineScope] :: ConfReportType -> !Text [timelineParams] :: ConfReportType -> !TimelineParams data ConfScope ConfScope :: !Text -> !(NonEmpty FilePath) -> ConfScope [csName] :: ConfScope -> !Text [csPaths] :: ConfScope -> !(NonEmpty FilePath) data ConfReport ConfReport :: !ConfReportType -> !Text -> ![ScopeModifier] -> ConfReport [crType] :: ConfReport -> !ConfReportType [crName] :: ConfReport -> !Text [crModifiers] :: ConfReport -> ![ScopeModifier] data OrgStatConfig OrgStatConfig :: ![ConfScope] -> ![ConfReport] -> !TimelineParams -> ![Text] -> !FilePath -> !Int -> OrgStatConfig [confScopes] :: OrgStatConfig -> ![ConfScope] [confReports] :: OrgStatConfig -> ![ConfReport] [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.ConfScope instance GHC.Show.Show OrgStat.Config.ConfReportType 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.Report.Timeline.TimelineParams instance Data.Aeson.Types.FromJSON.FromJSON OrgStat.Config.ConfReportType 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, WithLogger m) => FilePath -> m OrgStatConfig instance GHC.Show.Show OrgStat.IO.OrgIOException instance GHC.Exception.Exception OrgStat.IO.OrgIOException -- | Main logic combining all components module OrgStat.Logic convertRange :: (MonadIO m) => ConfRange -> m (LocalTime, LocalTime) runOrgStat :: WorkM ()