Start work on the UI
This commit is contained in:
parent
ef4a519e19
commit
223905301f
6 changed files with 280 additions and 30 deletions
|
|
@ -1,29 +0,0 @@
|
|||
-- | A way to store the 'Task's that preserves the original task order
|
||||
|
||||
module TaskMachine.TaskList
|
||||
( LTask(..)
|
||||
, fromTasks
|
||||
, loadLTasks
|
||||
) where
|
||||
|
||||
import qualified Data.Vector as V
|
||||
import Text.Megaparsec
|
||||
|
||||
import TaskMachine.Todotxt
|
||||
|
||||
data LTask = LTask
|
||||
{ ltaskNumber :: Integer
|
||||
-- ^ Sort by this number to get the original order of the tasks
|
||||
, ltaskTask :: Task
|
||||
-- ^ The 'Task' itself
|
||||
} deriving (Show)
|
||||
|
||||
fromTasks :: [Task] -> [LTask]
|
||||
fromTasks = zipWith LTask [1..]
|
||||
|
||||
loadLTasks :: FilePath -> IO (Either String (V.Vector LTask))
|
||||
loadLTasks file = do
|
||||
content <- readFile file
|
||||
case parseTasks file content of
|
||||
Right tasks -> pure $ Right $ V.fromList $ fromTasks tasks
|
||||
Left parseError -> pure $ Left $ show parseError
|
||||
Loading…
Add table
Add a link
Reference in a new issue