Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update signature due to Iterable and Collectable refactoring #152

Merged
merged 1 commit into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/foreach-yield.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,16 @@ The workhorse behind the `foreach-yield` construct is the `Iterable` trait
(discussed in the previous section) and the `Collectable` trait.

```flix
pub trait Collectable[m: Type -> Type] {
pub trait Collectable[t: Type] {
///
/// The element type of the Collectable.
///
type Elm[t]: Type

///
/// Run an Iterator collecting the results.
///
pub def collect(iter: Iterator[a, r]): m[a] \ r with Order[a]
pub def collect(iter: Iterator[Collectable.Elm[t], ef, r]): t \ (ef + Collectable.Aef[t] + r)
}
```

Expand Down
9 changes: 7 additions & 2 deletions src/foreach.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,16 @@ defines a single signature:
///
/// A trait for immutable data structures that can be iterated.
///
pub trait Iterable[t: Type -> Type] {
pub trait Iterable[t] {
///
/// The element type of the Iterable.
///
type Elm[t]: Type

///
/// Returns an iterator over `t`.
///
pub def iterator(rc: Region[r], t: t[a]): Iterator[a, r, r] \ r
pub def iterator(rc: Region[r], t: t): Iterator[Iterable.Elm[t], r + aef, r] \ (r + aef) where Iterable.Aef[t] ~ aef
}
```

Expand Down
Loading