Skip to content

Add Spore0 - #35

Merged
phaller merged 1 commit into
phaller:mainfrom
jspenger:spore0
Apr 14, 2026
Merged

Add Spore0#35
phaller merged 1 commit into
phaller:mainfrom
jspenger:spore0

Conversation

@jspenger

@jspenger jspenger commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

This PR adds Spore0 parameterized by evidence type F: Spore0[F[_], +T].

A Spore is now implemented as a type alias thereof: type Spore[+T] = Spore0[ReadWriter, T].
Similarly, Duplicate is replaced by Spore0[Duplicable, T].

Further changes include:
.unwrap() replaced by .get();
update test cases;
and new test cases for the sample module.

Additionally, the builder syntax has been replaced:

Old:

object Predicate extends SporeBuilder[Int => Boolean]({
    x => x > 10
})

New:

object Predicate extends SporeBuilder[Int => Boolean] {
    override def body = x => x > 10
}

@jspenger

jspenger commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

Closes #30

Comment thread spores3/src/spores/Spore0.scala Outdated
* @param ev1
* The implicit `Spore0[F, F[E1]]` used for packing the `env`.
* @tparam E1
* The type of the value applied to the packed closure.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here it should say: "The type of the value the packed closure is applied to."

Comment thread spores3/src/spores/Spore0.scala Outdated
* both are individually unwrapped and applied to each other.
*
* @param env
* The value applied to the packed closure.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here it should say: "The value the packed closure is applied to."

Comment thread spores3/src/spores/Spore0.scala Outdated
* unwrapping, both are individually unwrapped and applied to each other.
*
* @param env
* The context value applied to the packed closure.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here it should say: "The context value the packed closure is applied to."

Comment thread spores3/src/spores/Spore0.scala Outdated
* @param ev1
* The implicit `Spore0[F, F[E1]]` used for packing the `env`.
* @tparam E1
* The type of the context value applied to the packed closure.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here it should say: "The type of the context value the packed closure is applied to."

Comment thread spores3/src/spores/Spore0.scala Outdated
*
* This avoids the need to pack the `env` as it already is a Spore.
*
* Only available if the wrapped closure of type `T` is a subtype of `T1 ?=>

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo, it should be: "is a subtype of `E1 ?=>"

- Add `Spore0[F[_], +T]` parameterized by evidence type F
- `Spore[+T]` now implemented as type alias of `Spore0[ReadWriter, T]`
- `Duplicate` replaced by `Spore0[Duplicable, T]`
- `.unwrap()` replaced by `.get()`
- Update test cases
- Add test cases for sample module
- Fix PR comments
@jspenger

jspenger commented Apr 11, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the requested changes.

@jspenger
jspenger requested a review from phaller April 11, 2026 15:53
@phaller
phaller merged commit f1278a2 into phaller:main Apr 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants