diff options
Diffstat (limited to 'stdlib/source/program')
-rw-r--r-- | stdlib/source/program/aedifex/project.lux | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/stdlib/source/program/aedifex/project.lux b/stdlib/source/program/aedifex/project.lux index 15abd9ee1..071f54b12 100644 --- a/stdlib/source/program/aedifex/project.lux +++ b/stdlib/source/program/aedifex/project.lux @@ -1,8 +1,9 @@ (.module: [lux (#- Name) [abstract - ["." monad (#+ do)] - ["." equivalence (#+ Equivalence)]] + [equivalence (#+ Equivalence)] + [monoid (#+ Monoid)] + ["." monad (#+ do)]] [control ["." try (#+ Try)] ["." exception (#+ exception:)]] @@ -19,13 +20,23 @@ (type: #export Project (Dictionary Name Profile)) -(def: #export empty - (dictionary.from-list text.hash (list [//.default (:: //.monoid identity)]))) +(def: #export (project name profile) + (-> Name Profile Project) + (dictionary.from-list text.hash (list [name profile]))) (def: #export equivalence (Equivalence Project) (dictionary.equivalence //.equivalence)) +(structure: #export monoid + (Monoid Project) + + (def: identity + (dictionary.new text.hash)) + + (def: compose + (dictionary.merge-with (:: //.monoid compose)))) + (exception: #export (unknown-profile {name Name}) (exception.report ["Name" (%.text name)])) @@ -50,12 +61,12 @@ (get@ #//.parents profile))] (wrap (list@fold (function (_ parent child) (:: //.monoid compose child parent)) - profile + (set@ #//.parents (list) profile) parents)))) #.None (exception.throw ..unknown-profile [name]))) -(def: #export (profile project name) - (-> Project Name (Try Profile)) - (profile' (set.new text.hash) project name)) +(def: #export (profile name project) + (-> Name Project (Try Profile)) + (..profile' (set.new text.hash) project name)) |