Running pre-commit for the first time.
This commit is contained in:
parent
c7aa5e19a9
commit
5854408466
10 changed files with 22 additions and 22 deletions
|
@ -7,7 +7,7 @@ To start reading, please use the [Table of Contents](./table-of-contents.md)
|
||||||
|
|
||||||
## What is Ava?
|
## What is Ava?
|
||||||
|
|
||||||
Ava is a programming language research project that is in the design and
|
Ava is a programming language research project that is in the design and
|
||||||
specification phase. There is no grammar, parser, compiler, or way to use any
|
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.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Constants
|
# Constants
|
||||||
|
|
||||||
_Constants_ are definitions which provide a name and explicit type for some
|
_Constants_ are definitions which provide a name and explicit type for some
|
||||||
[value](values.md). The `const` keyword (definition type) is used to define a
|
[value](values.md). The `const` keyword (definition type) is used to define a
|
||||||
constant.
|
constant.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Definitions
|
# Definitions
|
||||||
|
|
||||||
_Definitions_ are Ava constructs that may live at the top level within some
|
_Definitions_ are Ava constructs that may live at the top level within some
|
||||||
namespace. [Functions](functions.md) in particular may _also_ live within type
|
namespace. [Functions](functions.md) in particular may _also_ live within type
|
||||||
class (and instance) definitions.
|
class (and instance) definitions.
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ All definitions adhere to the following syntax:
|
||||||
[export] <definition type> <name> <description> is <body>
|
[export] <definition type> <name> <description> is <body>
|
||||||
```
|
```
|
||||||
|
|
||||||
Each definition type ultimately controls the description and body. All
|
Each definition type ultimately controls the description and body. All
|
||||||
definition names adhere to standard [Name](names.md) rules.
|
definition names adhere to standard [Name](names.md) rules.
|
||||||
|
|
||||||
## Supported Definition Types
|
## Supported Definition Types
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
## The Effect Type
|
## The Effect Type
|
||||||
|
|
||||||
The type `IO[E, A]` represents an effect which will produce `A` when executed,
|
The type `IO[E, A]` represents an effect which will produce `A` when executed,
|
||||||
and may fail with an error of type `E`. There exists a type
|
and may fail with an error of type `E`. There exists a type
|
||||||
`type Task[A] = IO[Nothing, A]` that represents effects that cannot fail with an
|
`type Task[A] = IO[Nothing, A]` that represents effects that cannot fail with an
|
||||||
error.
|
error.
|
||||||
|
|
|
@ -5,7 +5,7 @@ that will produce a _value_ when evaluated.
|
||||||
|
|
||||||
## Syntax
|
## Syntax
|
||||||
|
|
||||||
Most non-[Definition](definitions.md) code is considered an expression.
|
Most non-[Definition](definitions.md) code is considered an expression.
|
||||||
Expressions include:
|
Expressions include:
|
||||||
|
|
||||||
- Literals
|
- Literals
|
||||||
|
@ -32,7 +32,7 @@ if <boolean expr> then <expr> else <expr>
|
||||||
|
|
||||||
TODO: This is incomplete
|
TODO: This is incomplete
|
||||||
|
|
||||||
The `do/yield` expression allows for imperative composition of monadic
|
The `do/yield` expression allows for imperative composition of monadic
|
||||||
expressions.
|
expressions.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Functions
|
# Functions
|
||||||
|
|
||||||
TODO: Scala syntax? Haskell syntax? Implications? How do we specify names for
|
TODO: Scala syntax? Haskell syntax? Implications? How do we specify names for
|
||||||
parameters? Do we want to do that? How do function arguments, tuples, and
|
parameters? Do we want to do that? How do function arguments, tuples, and
|
||||||
records all relate to one another? Are they all just the same? How do we talk
|
records all relate to one another? Are they all just the same? How do we talk
|
||||||
about curried functions? Is that supported? Is there some other mechanism?
|
about curried functions? Is that supported? Is there some other mechanism?
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ example { x: 1, y: 2 }
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
fn map[F[*], A, B]: (F[A]) => (A => B) => F[B] is
|
fn map[F[*], A, B]: (F[A]) => (A => B) => F[B] is
|
||||||
(fa) (f) => fa f
|
(fa) (f) => fa f
|
||||||
|
|
||||||
map(list)(x => x + 1)
|
map(list)(x => x + 1)
|
||||||
|
|
|
@ -27,7 +27,7 @@ separated by the `.` character.
|
||||||
|
|
||||||
## Reserved Names
|
## Reserved Names
|
||||||
|
|
||||||
Any namespaces provided with a particular Ava distribution are considered
|
Any namespaces provided with a particular Ava distribution are considered
|
||||||
_reserved_. This means that, for example, the following namespaces cannot be
|
_reserved_. This means that, for example, the following namespaces cannot be
|
||||||
used:
|
used:
|
||||||
|
|
||||||
|
@ -55,11 +55,11 @@ scope.
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
Each import is a single, fully-qualified name. Imported names MAY be mapped to
|
Each import is a single, fully-qualified name. Imported names MAY be mapped to
|
||||||
some alternative name. An import may refer to a specific namespace or it may
|
some alternative name. An import may refer to a specific namespace or it may
|
||||||
refer to some specific definition within a namespace.
|
refer to some specific definition within a namespace.
|
||||||
|
|
||||||
TODO: Account for type classes. How can we easily import instances? One option
|
TODO: Account for type classes. How can we easily import instances? One option
|
||||||
is to NOT do this. Ever. Just resolve EVERY possible `instance` during
|
is to NOT do this. Ever. Just resolve EVERY possible `instance` during
|
||||||
compilation and make them available within the scope of the program. Global.
|
compilation and make them available within the scope of the program. Global.
|
||||||
Very strict one-instance-per-thing side-effect, but could be useful.
|
Very strict one-instance-per-thing side-effect, but could be useful.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Records
|
# Records
|
||||||
|
|
||||||
Records may be defined. Each record contains one or more named fields. Note that
|
Records may be defined. Each record contains one or more named fields. Note that
|
||||||
records are just [tuples](tuples.md) with named fields. In many ways, the two
|
records are just [tuples](tuples.md) with named fields. In many ways, the two
|
||||||
can be interchanged.
|
can be interchanged.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -45,7 +45,7 @@ let foo2 := Foo(x := "foo", y := 1)
|
||||||
|
|
||||||
## Copying Data
|
## Copying Data
|
||||||
|
|
||||||
Copy syntax allows any record to be duplicated, with any fields explicitly
|
Copy syntax allows any record to be duplicated, with any fields explicitly
|
||||||
overridden by some value:
|
overridden by some value:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -97,5 +97,5 @@ let foo: Foo := some_tuple
|
||||||
|
|
||||||
## Destructuring Records
|
## Destructuring Records
|
||||||
|
|
||||||
Records can be _destructured_ via [pattern matching](pattern-matching.md)
|
Records can be _destructured_ via [pattern matching](pattern-matching.md)
|
||||||
capabilities. This can take two possible forms.
|
capabilities. This can take two possible forms.
|
||||||
|
|
|
@ -15,7 +15,7 @@ let w := ("foo", 1, true, 3.14)
|
||||||
|
|
||||||
## Type of a Standard Tuple
|
## Type of a Standard Tuple
|
||||||
|
|
||||||
Consider the tuple `("foo", 1, true, 3.14)`. It has type
|
Consider the tuple `("foo", 1, true, 3.14)`. It has type
|
||||||
`(String, Int32, Boolean, Float64)`.
|
`(String, Int32, Boolean, Float64)`.
|
||||||
|
|
||||||
## The Empty Tuple
|
## The Empty Tuple
|
||||||
|
@ -25,7 +25,7 @@ typically used as a token to indicate side-effects with no other useful output.
|
||||||
|
|
||||||
## Accessing Tuple Members
|
## Accessing Tuple Members
|
||||||
|
|
||||||
Each tuple member is _indexed_ and can be directly accessed via a property of
|
Each tuple member is _indexed_ and can be directly accessed via a property of
|
||||||
that index:
|
that index:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -54,7 +54,7 @@ let (x, y, z) := w
|
||||||
```
|
```
|
||||||
let w := ("foo", 1, true)
|
let w := ("foo", 1, true)
|
||||||
|
|
||||||
let z :=
|
let z :=
|
||||||
match w
|
match w
|
||||||
case ("foo", _, x) => x
|
case ("foo", _, x) => x
|
||||||
case _ => false
|
case _ => false
|
||||||
|
|
6
types.md
6
types.md
|
@ -9,8 +9,8 @@
|
||||||
## The Ava Type System
|
## The Ava Type System
|
||||||
|
|
||||||
Ava is based on a static type system with support for higher-kinded types. Ava
|
Ava is based on a static type system with support for higher-kinded types. Ava
|
||||||
does not support inheritence. Ava _does_ support sum types
|
does not support inheritence. Ava _does_ support sum types
|
||||||
([Enumerations](enumerations.md)) and _does_ support
|
([Enumerations](enumerations.md)) and _does_ support
|
||||||
[type classes](type-classes.md).
|
[type classes](type-classes.md).
|
||||||
|
|
||||||
## The Nothing Type
|
## The Nothing Type
|
||||||
|
@ -22,7 +22,7 @@ example, `Either[Nothing, String]` satisfies `Either[Int32, String]`.
|
||||||
|
|
||||||
## Type Definitions
|
## Type Definitions
|
||||||
|
|
||||||
Types may directly, at the top level, be defined in terms of some
|
Types may directly, at the top level, be defined in terms of some
|
||||||
[type constructor](#type-constructors):
|
[type constructor](#type-constructors):
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
Loading…
Add table
Reference in a new issue