Motivation
I am currently working on a small hobby project to try to implement something like TaskJuggler in Haskell, mainly as an experiment for playing with domain language writing.
My current goal is to have a small DSL to create a description Project, as well as an associated Tasks. There is no hierarchy yet, although this will be my next extension. I currently have the following data types:
data Project = Project { projectName :: Text
, projectStart :: Day
, projectEnd :: Day
, projectMaxHoursPerDay :: Int
, projectTasks :: [Task]
}
deriving (Eq, Show)
data Task = Task { taskName :: Text }
deriving (Eq, Show)
Nothing crazy there, I'm sure you will agree.
DSL /. Writer [Task] , . , :
project "LambdaBook" startDate endDate $ do
task "Web site"
task "Marketing"
project :: Text -> Date -> Date -> Writer [Task] a, Writer , 8 projectMaxHoursPerDay.
- :
project "LambdaBook" $ do
maxHoursPerDay 4
task "Web site"
task "Marketing"
maxHoursPerDay () Project. Writer , [Task] , .
:
""
Project :
data Project = Project { projectName, projectStart, projectEnd, projectProperties }
data ProjectProperties = ProjectProperties { projectMaxHoursPerDay :: Maybe Int
, projectTasks :: [Task]
}
Monoid ProjectProperties. Writer ProjectProperties, , Project. , , Project ProjectProperties - , .
Semigroup m => Writer m
Project Monoid, , , Semigroup. // First, maxHoursPerDay - Last, projectTasks - [Task]. Writer a Semigroup, Writer.
- "" Monoid - . Project ProjectProperties, . Project - (maxHoursPerDay Just, !).
, , , (- return/pure).
http://hpaste.org/82024 ( ) http://hpaste.org/82025 ( ). , SO- ( ), Resource Task. , , Bind ( Monad) DSL.
, , , .