diff --git a/README.md b/README.md index cdfaabb..63adec6 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,7 @@ specification phase. There is no grammar, parser, compiler, or way to use any Ava code. Ava is a way to get ideas out of my head, challenged, and further explored. -## Notes +## Documentation -These notes are not guaranteed to be up to date and represent a large amount of -brainstorming and trying/discarding of ideas. - -Please start with the [Table of Contents](./notes/table-of-contents.md) +Please start with the [Documentation Contents](./docs), which provides links to +different iterations of the language. diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..83afe61 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,6 @@ +# Ava Documentation + +This documentation is currently organized by revision, where major updates are +made to the specification. + +- [R2](./revision2.md) diff --git a/docs/revision2.md b/docs/revision2.md new file mode 100644 index 0000000..3ca64cc --- /dev/null +++ b/docs/revision2.md @@ -0,0 +1,66 @@ +# Ava R2 + +This document specifies the second revision of the Ava programming language, +started 2024-07-18. + +## Example + +- TODO: Disambiguate `fn` with and without implementation. + +``` +fn not: Boolean -> Boolean + λ false => true + λ true => false +end fn + +given A +given B +class Eq + fn eq: A -> B -> Boolean + + fn neq: A -> B -> Boolean + λ x y => not (eq x y) + end fn + + infix =: A -> B -> Boolean + λ x y => eq x y + end infix + + infix !=: A -> B -> Boolean + λ x y => neq x y + end infix +end class + +given F * +class Functor + --- Transform some wrapped data from one type to another, preserving the + --- wrapper. + --- + --- @tparam A The type of input data. + --- @tparam B The type of output data. + given A + given B + fn map: F A -> (A -> B) -> F B +end class + +given A +class Semigroup + fn combine: A -> A -> A +end class + +given A :: Semigroup +class Monoid + fn empty: A +end class + +fn silly_string: String -> Int32 + λ "foo" => 1 + λ "bar" => 2 + λ baz => + -- No reason to do this, but demonstrates the syntax. + baz match + case "baz" => 3 + case _ => 4 + end match +end fn +```