-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d80eec1
Showing
5 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Repo Admin | ||
on: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- doc/* | ||
- src/*/*.scala | ||
jobs: | ||
admin: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Tidy repository | ||
uses: propensive/tumult@0.5.1 | ||
- name: Autocommit changes | ||
uses: stefanzweifel/git-auto-commit-action@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Build | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Setup Java 19 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '19' | ||
- name: Get Wrath | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: 'propensive/wrath' | ||
path: 'wrath' | ||
ref: '0.5.1' | ||
- name: Build | ||
run: "wrath/wrath -F -x" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Publish | ||
on: | ||
push: | ||
tags: | ||
- 'pending/*' | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 | ||
- name: Setup Java 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '11' | ||
- name: Fetch tags | ||
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | ||
- name: Get Version | ||
id: tagName | ||
run: echo ::set-output name=version::${GITHUB_REF#refs/tags/pending/} | ||
- name: 'Abort if tag exists' | ||
id: checkTagged | ||
shell: bash | ||
run: git show-ref --tags --verify --quiet -- "refs/tags/release/${{ steps.tagName.outputs.version }}" && exit 1 || exit 0 | ||
- name: Publish | ||
run: echo Publishing | ||
- name: Tag release | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.RELEASE_TOKEN }} | ||
script: | | ||
let newRef = context.ref.replace('pending', 'release'); | ||
github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: newRef, | ||
sha: context.sha | ||
}); | ||
github.rest.git.deleteRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: context.ref.substring(5) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# This is a buildfile for Fury or Wrath. | ||
# More information is available at: https://github.com/propensive/wrath/ | ||
target feudalism/test | ||
|
||
repo propensive/probably | ||
|
||
project feudalism | ||
module core | ||
compiler scala | ||
sources src/core | ||
include rudiments/core | ||
|
||
module test | ||
compiler scala | ||
include feudalism/core probably/cli | ||
sources src/test | ||
main feudalism.Tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package feudalism | ||
|
||
import language.experimental.captureChecking | ||
|
||
class Ref[ValueType](get: ValueType): | ||
def apply(): ValueType = get | ||
def copy(): ValueType^{this} = get | ||
|
||
class Mutex[ValueType](initial: ValueType): | ||
private var count: Int = 0 | ||
private var value: ValueType = initial | ||
|
||
def read | ||
[ResultType, ImmutableType] | ||
(using immutable: Immutable[ValueType, ImmutableType]) | ||
(fn: (ref: Ref[ImmutableType]^) => ResultType) | ||
: ResultType^{fn*} = | ||
|
||
synchronized: | ||
while count == -1 do wait() | ||
count += 1 | ||
|
||
val result = fn(Ref(immutable(value))) | ||
|
||
synchronized: | ||
count -= 1 | ||
notify() | ||
|
||
result | ||
|
||
def mutate(fn: ValueType => Unit): Unit = | ||
synchronized: | ||
while count != 0 do wait() | ||
count = -1 | ||
|
||
fn(value) | ||
|
||
synchronized: | ||
count = 0 | ||
notify() | ||
|
||
def replace(fn: ValueType => ValueType): Unit = | ||
synchronized: | ||
while count != 0 do wait() | ||
count = -1 | ||
|
||
value = fn(value) | ||
|
||
synchronized: | ||
count = 0 | ||
notify() | ||
|
||
trait Immutable[MutableType, ImmutableType]: | ||
def apply(ref: MutableType): ImmutableType | ||
|
||
object Immutable: | ||
given [ElementType]: Immutable[Array[ElementType], IArray[ElementType]] with | ||
def apply(ref: Array[ElementType]): IArray[ElementType] = ref.asInstanceOf[IArray[ElementType]] | ||
|
||
given Immutable[StringBuilder, String] with | ||
def apply(ref: StringBuilder): String = ref.toString | ||
|
||
given [ValueType](using DummyImplicit): Immutable[ValueType, ValueType] with | ||
def apply(ref: ValueType): ValueType = ref |