(;module: lux (lux (control monad) [io #- run] [cli #+ program: CLI Monad]) (luxc ["&;" parser])) (type: Path Text) (type: Platform #JVM #JS) (type: Mode #Release #Debug) (type: Compilation {#mode Mode #platform Platform #program Path #target Path}) (type: Inputs {#resources (List Path) #sources (List Path)}) (def: (marker tokens) (-> (List Text) (CLI Unit)) (cli;after (cli;option tokens) (:: Monad wrap []))) (def: (tagged tags) (-> (List Text) (CLI Text)) (cli;after (cli;option tags) cli;any)) (def: mode^ (CLI Mode) ($_ cli;alt (marker (list "release")) (marker (list "debug")))) (def: platform^ (CLI Platform) ($_ cli;alt (marker (list "jvm")) (marker (list "js")))) (def: compilation^ (CLI Compilation) ($_ cli;seq mode^ platform^ (tagged (list "-p" "--program")) (tagged (list "-t" "--target")))) (def: inputs^ (CLI Inputs) ($_ cli;seq (cli;some (tagged (list "-r" "--resource"))) (cli;some (tagged (list "-s" "--source"))))) (program: ([[command [resources sources]] (cli;seq (cli;opt compilation^) inputs^)]) (case command #;None (io (log! "Hello, REPL!")) (#;Some [mode platform program target]) (io (log! "Hello, compilation!"))))