(.module: [library [lux "*" [abstract ["[0]" monad]] [control ["<>" parser ("[1]\[0]" monad) ["" code {"+" [Parser]}] ["" analysis] ["" synthesis]]] [data ["[0]" product] [collection ["[0]" list ("[1]\[0]" functor)]]] [macro {"+" [with_identifiers]} ["[0]" code] [syntax {"+" [syntax:]}]] [tool [compiler ["[0]" phase]]]]]) (type: Declaration (Record [#name Code #label Text #phase Text #archive Text #inputs (List Code)])) (def: (declaration default) (-> Code (Parser Declaration)) (.form ($_ <>.and .any .local_identifier .local_identifier .local_identifier (.tuple (<>.some .any))))) (template [ ] [(syntax: .public ( [[name extension phase archive inputs] (..declaration (` )) body .any]) (let [g!name (code.local_identifier extension) g!phase (code.local_identifier phase) g!archive (code.local_identifier archive)] (with_identifiers [g!handler g!inputs g!error g!_] (in (list (` ( (~ name) (.function ((~ g!handler) (~ g!name) (~ g!phase) (~ g!archive) (~ g!inputs)) (.case ((~! ) ((~! monad.do) (~! <>.monad) [(~+ inputs) (~ g!_) ] (.\ (~! <>.monad) (~' in) (~ body))) (~ g!inputs)) (#.Right (~ g!_)) (~ g!_) (#.Left (~ g!error)) ((~! phase.failure) (~ g!error))) ))))))))] [.any .end! .and .result "lux def analysis" analysis:] [.any .end! .and .result "lux def synthesis" synthesis:] [.any .end! .and .result "lux def generation" generation:] [.any .end! .and .result "lux def directive" directive:] )