diff options
Diffstat (limited to 'stdlib/source/lux/control/remember.lux')
-rw-r--r-- | stdlib/source/lux/control/remember.lux | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/stdlib/source/lux/control/remember.lux b/stdlib/source/lux/control/remember.lux deleted file mode 100644 index aeda22262..000000000 --- a/stdlib/source/lux/control/remember.lux +++ /dev/null @@ -1,73 +0,0 @@ -(.module: - [lux #* - [abstract - [monad (#+ do)]] - [control - ["." io] - ["." try] - ["." exception (#+ exception:)] - ["<>" parser ("#\." functor) - ["<c>" code (#+ Parser)]]] - [data - ["." text - ["%" format (#+ format)]]] - [time - ["." instant] - ["." date (#+ Date) ("#\." order)]] - ["." meta] - [macro - ["." code] - [syntax (#+ syntax:)]]]) - -(exception: #export (must_remember {deadline Date} {today Date} {message Text} {focus (Maybe Code)}) - (exception.report - ["Deadline" (%.date deadline)] - ["Today" (%.date today)] - ["Message" message] - ["Code" (case focus - (#.Some focus) - (%.code focus) - - #.None - "")])) - -(def: deadline - (Parser Date) - ($_ <>.either - (<>\map (|>> instant.from_millis instant.date) - <c>.int) - (do <>.monad - [raw <c>.text] - (case (\ date.codec decode raw) - (#try.Success date) - (wrap date) - - (#try.Failure message) - (<>.fail message))))) - -(syntax: #export (remember {deadline ..deadline} {message <c>.text} {focus (<>.maybe <c>.any)}) - (let [now (io.run instant.now) - today (instant.date now)] - (if (date\< deadline today) - (wrap (case focus - (#.Some focus) - (list focus) - - #.None - (list))) - (meta.fail (exception.construct ..must_remember [deadline today message focus]))))) - -(template [<name> <message>] - [(syntax: #export (<name> {deadline ..deadline} {message <c>.text} {focus (<>.maybe <c>.any)}) - (wrap (list (` (..remember (~ (code.text (%.date deadline))) - (~ (code.text (format <message> " " message))) - (~+ (case focus - (#.Some focus) - (list focus) - - #.None - (list))))))))] - - [to_do "TODO"] - [fix_me "FIXME"] - ) |