Writing a book on programming using program descriptions using Dotty


… long slightly technical post, ignore if not interested …

I’m back at this forum after being away for some time.

I’m an FP/OOP veteran who is semi-retired (which means that, besides cycling and gardening I (finally) have time for my addiction).

I’ve been working on programming using program descriptions (monads, applicatives, arrows or what have you) since the nineties.

Since I have a bit more time now I am planning to write a book (no publisher yet) with (among others) the following goals in mind

  • use Dotty and exploit its power/elegance of expression
  • self-contained explanation of programming using program descriptions
    [ the approach is top-down rather than bottom-up ]
  • encourage pointfree decriptions spiced with a bit of Dotty DSL flavor
    [ monads encourage pointful, arrows encourage pointfree ]
    [ pointfree is traditionally considererd a bit cumbersome but Dotty DSL flavor comes to the rescue ]
    [ this is challenging, not sure how far I can push this but the future looks bright ]

I have two github projects

(1) https://github.com/LucDupAtGitHub/Feature-Based-Functional-Programming-with-Dotty
(2) https://github.com/LucDupAtGitHub/Feature-Based-Functional-Programming-Book

I stated with (1) and I am as far as

  • basic program features: identity, composition, local defs (product), if-then-else control (sum))
    [ implemented in an active way using >-a-> where Z >-a-> Y == Z => Y ]
  • failure
    [ >--a-> transformed to the failure world >-at-> where Z >-at-> Y == Z >-a-> Try[Y] (for some Try[+ _]) ]
  • parallelism
    [ >-a-> transformed to the reactive world >-r-> where Z >-r-> Y == (Z >-a=> Unit) >-a-> Unit ]
  • state
    [ >-a-> transformed to the stateful world >-as-> where Z >-as-> Y == Z >-a-> (S >-a-> (S, Z)) ]
  • (advanced) control
    [ a bit more complex, but let’s say a pointfree version of delimited continuations … ]
  • and, of course, all combinations …

The code works, but is not fully cleaned up yet. There is dcocumentation in the README.md.

Recently I decided to go for (2) as a replacement of (1)

  • clean up code
  • use LaTeX to produce high quality pdf output

Please have a look if you are interested.
All feedback are welcome.
Do not hesitate to contact me luc.duponcheel@gmail.com



1 Like