Skip to content

Commit

Permalink
Add some (short, incomplete) notes on design
Browse files Browse the repository at this point in the history
  • Loading branch information
noelwelsh committed Aug 12, 2024
1 parent 7505cfd commit c0efafd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/src/pages/development/design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Design

The API that Doodle presents to the user should be compositional and easy to reason about.
There are fundamental ideas in functional programming.
Internally, the implementation may be a stateful program, as the majority of graphics library are implemented in a stateful way.


## Conveniences

We provide convenience operations for common operations.
For example, we can just `draw` a `Picture` without providing a `Canvas` or `Frame`, or having to deal with `IO`.

Conveniences that run `IO` should be implemented as syntax.
Other conveniences should generally be implemented as methods on algebras,
implemented in terms of more basic methods on the algebra.
(Note that the current system is very mixed on whether this is followed or not.)

The default operations, provided as syntax, generally do not expose `IO`.
Altneratives that do expose `IO` are suffixed `toIO`.
So, for example, `draw` is the default operation to render a `Picture` and does not expose an `IO`.
The syntax that does is called `drawToIO`.
1 change: 1 addition & 0 deletions docs/src/pages/development/directory.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
laika.navigationOrder = [
README.md
design.md
process.md
syntax.md
backend.md
Expand Down

0 comments on commit c0efafd

Please sign in to comment.