Murat Kasimov

More about me

Я language (β)

/Я language (β)/Tutorials/Command line task manager 7/

Full source codePrevious chapterNext chapter

Let's introduce task statuses - they either completed or waiting for completion:

type Status = Unit `S` Unit

In addition we add pattern synonyms to avoid confusion:

pattern TODO e = This e pattern DONE e = That e

Statuses should be included in a task type declaration:

type Task = Status `P` String

Printing expression is bloating, it's good time to split it on lines and blocks:

> line = is @( Cursor `P` Task ) >> `yio'yio'yoi` TODO `hu` "TODO" `la` DONE `hu` "DONE" >> `yio'yio` to @( Nonempty List ) `ha` Merge @( Nonempty List ) >> `yio'yoi` Focus `hu` " -> " `la` Exist `hu` " - " >> `yio` to @( Nonempty List ) `ha` Merge @( Nonempty List )

Challenge: try to rewrite a snippet above using at morphism instead of implicit mappings (yio'yio'yoi, yio'yio, yio'yoi, yio).

Printing looks a bit clearer now:

> block tasks = tasks >> `kyokl` Focus `ha` Forth `ha` Await >> `ha___'he` line `ha` swap >>> `ho__'yokl` Forth `ha` Await `ha` output >>> `ho__'yuk` Await `ha` output `ha` Caret `hv'he` Newline