Kicking off r2
This commit is contained in:
parent
1bd0e383ed
commit
a4add937c8
3 changed files with 75 additions and 5 deletions
|
@ -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
|
Ava code. Ava is a way to get ideas out of my head, challenged, and further
|
||||||
explored.
|
explored.
|
||||||
|
|
||||||
## Notes
|
## Documentation
|
||||||
|
|
||||||
These notes are not guaranteed to be up to date and represent a large amount of
|
Please start with the [Documentation Contents](./docs), which provides links to
|
||||||
brainstorming and trying/discarding of ideas.
|
different iterations of the language.
|
||||||
|
|
||||||
Please start with the [Table of Contents](./notes/table-of-contents.md)
|
|
||||||
|
|
6
docs/README.md
Normal file
6
docs/README.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# Ava Documentation
|
||||||
|
|
||||||
|
This documentation is currently organized by revision, where major updates are
|
||||||
|
made to the specification.
|
||||||
|
|
||||||
|
- [R2](./revision2.md)
|
66
docs/revision2.md
Normal file
66
docs/revision2.md
Normal file
|
@ -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
|
||||||
|
```
|
Loading…
Add table
Reference in a new issue