Safe Haskell | None |
---|---|
Language | Haskell2010 |
Main API for WorkTime. This re-exports all functions meant to be used.
Synopsis
- data WorkTime = WorkTime MessageLine [Workday]
- data MessageLine
- data Workday
- fromText :: Text -> Either (ParseError (Token Text) Void) [WorkTime]
- fromFile :: FilePath -> IO (Either (ParseError (Token Text) Void) [WorkTime])
- workTimeHours :: WorkTime -> Double
- workTimeNickname :: WorkTime -> Text
- hoursFromText :: Text -> Either (ParseError (Token Text) Void) [(Text, Double)]
- hoursFromFile :: FilePath -> IO (Either (ParseError (Token Text) Void) [(Text, Double)])
- hours :: [WorkTime] -> Map Text Double
Documentation
Main data type of the library. Represents an entry in Slack containing
a nickname, timestamp, datestamp and WorkDay
that themselves contain
several task descriptions.
An entire entry will look as follows:
Rickard Andersson [11:16 PM] [28.02] 8.5h worked on missile guidance system cleaned up parsing code
The first part is represented by a MessageLine
and what follows is one
Workday
in this example.
An entry can also look as follows:
Rickard Andersson [11:16 PM] [28.02] 8.5h worked on missile guidance system cleaned up parsing code [01.03] 6h fixed critical bug in missile guidance system removed half of parsing code
data MessageLine Source #
Represents a line like Rickard Andersson [10:48 AM]
in Slack.
Instances
Show MessageLine Source # | |
Defined in WorkTime.WorkTime showsPrec :: Int -> MessageLine -> ShowS # show :: MessageLine -> String # showList :: [MessageLine] -> ShowS # |
Represents a collection of lines like
[28.02] 8.5h worked on missile guidance system cleaned up parsing code
in Slack.
fromText :: Text -> Either (ParseError (Token Text) Void) [WorkTime] Source #
Parses a Text
either into a [WorkTime
] or into an error message in the
form of a String
. The error message may be less than informative as it comes
straight from the parser (Text.Megaparsec).
fromFile :: FilePath -> IO (Either (ParseError (Token Text) Void) [WorkTime]) Source #
Parses the Text
in a file and returns either a [WorkTime
] or an error
message in the form of a String
. The error message may be less than
informative as it come straight from the parser (Text.Megaparsec).
workTimeHours :: WorkTime -> Double Source #
Extracts the total work hours from a WorkTime
entry, from all workdays
in the entry.