Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
bwireman committed May 12, 2024
1 parent 55431c9 commit 95e206b
Show file tree
Hide file tree
Showing 6 changed files with 221 additions and 226 deletions.
52 changes: 26 additions & 26 deletions dist/delay.d.mts
Expand Up @@ -2,65 +2,65 @@
/**
* Type representing a delayed effect to be lazily evaluated
*/
export type Delay$<GCD, GCE> = Continue<GCD, GCE> | Stop<GCE>
export type Delay$<GCV, GCU> = Continue<GCV, GCU> | Stop<GCV>


/**
* Stores an effect to be run later, short circuiting on errors
*/
export function delay_effect<GCF, GCG>(func: () => Result<GCF, GCG>): Delay$<GCF, GCG>
export function delay_effect<GCW, GCX>(func: () => Result<GCW, GCX>): Delay$<GCW, GCX>


/**
* Chains an operation onto an existing delay. The result of the current delay will be lazily passed to `func`
* `func` will not be called if the delay has already returned an error
*/
export function map<GCL, GCM, GCP>(delayed: Delay$<GCL, GCM>, func: (x0: GCL) => Result<GCP, GCM>): Delay$<GCP, GCM>
export function map<GDC, GDD, GDG>(delayed: Delay$<GDC, GDD>, func: (x0: GDC) => Result<GDG, GDD>): Delay$<GDG, GDD>


/**
* flatten a nested Delay
*/
export function flatten<GDD, GDE>(delayed: Delay$<Delay$<GDD, GDE>, GDE>): Delay$<GDD, GDE>
export function flatten<GDU, GDV>(delayed: Delay$<Delay$<GDU, GDV>, GDV>): Delay$<GDU, GDV>


/**
* Map and then flatten `delayed`
*/
export function flat_map<GDL, GDM, GDP>(
delayed: Delay$<GDL, GDM>,
func: (x0: GDL) => Result<Delay$<GDP, GDM>, GDM>
): Delay$<GDP, GDM>
export function flat_map<GEC, GED, GEG>(
delayed: Delay$<GEC, GED>,
func: (x0: GEC) => Result<Delay$<GEG, GED>, GED>
): Delay$<GEG, GED>


/**
* Run a delayed effect and get the result
* short-circuiting if any in delay in the chain returns an Error
*/
export function run<GFA, GFB>(delayed: Delay$<GFA, GFB>): Result<GFA, GFB>
export function run<GFR, GFS>(delayed: Delay$<GFR, GFS>): Result<GFR, GFS>


/**
* returns a delay, that joins two delays. If `left` fails `right` will not be run, if either fails the result will be an Error
*/
export function join<GDW, GDX, GEA, GEB>(
left: Delay$<GDW, GDX>,
right: Delay$<GEA, GEB>
): Delay$<[GDW, GEA], [Option$<GDX>, Option$<GEB>]>
export function join<GEN, GEO, GER, GES>(
left: Delay$<GEN, GEO>,
right: Delay$<GER, GES>
): Delay$<[GEN, GER], [Option$<GEO>, Option$<GES>]>


/**
* Returns a new Delay that will be re-attempted `retries` times with `delay` ms in-between
* NOTE: `delay` is ignored in JS
*/
export function retry<GEI, GEJ>(delayed: Delay$<GEI, GEJ>, retries: number, delay: number): Delay$<GEI, GEJ>
export function retry<GEZ, GFA>(delayed: Delay$<GEZ, GFA>, retries: number, delay: number): Delay$<GEZ, GFA>


/**
* Returns a new Delay that will be re-attempted `retries` times with `delay` ms in-between
* NOTE: `delay` is ignored in JS
*/
export function retry_with_backoff<GEO, GEP>(delayed: Delay$<GEO, GEP>, retries: number): Delay$<GEO, GEP>
export function retry_with_backoff<GFF, GFG>(delayed: Delay$<GFF, GFG>, retries: number): Delay$<GFF, GFG>


/**
Expand All @@ -73,13 +73,13 @@ export function drain(delayed: Delay$<any, any>): null
/**
* Run every effect in sequence and get their results
*/
export function every<GFR, GFS>(effects: List<Delay$<GFR, GFS>>): List<Result<GFR, GFS>>
export function every<GGI, GGJ>(effects: List<Delay$<GGI, GGJ>>): List<Result<GGI, GGJ>>


/**
* Repeat a Delay and return the results in a list
*/
export function repeat<GFK, GFL>(delayed: Delay$<GFK, GFL>, repetition: number): List<Result<GFK, GFL>>
export function repeat<GGB, GGC>(delayed: Delay$<GGB, GGC>, repetition: number): List<Result<GGB, GGC>>


/**
Expand All @@ -100,24 +100,24 @@ export function any(effects: List<Delay$<any, any>>): boolean
* Attempt multiple Delays until one returns an Ok
* unlike `any/1` this will short circuit on the first Ok
*/
export function fallthrough<GGU, GGV>(effects: List<Delay$<GGU, GGV>>): Result<GGU, GGV>
export function fallthrough<GHL, GHM>(effects: List<Delay$<GHL, GHM>>): Result<GHL, GHM>

export class Continue<GCE, GCD> extends CustomType {
export class Continue<GCV, GCU> extends CustomType {
constructor(effect: () => Result<any, any>)
effect(): Result<any, any>
}

export class Stop<GCE> extends CustomType {
constructor(err: GCE)
err: GCE
export class Stop<GCV> extends CustomType {
constructor(err: GCV)
err: GCV
}

export class Result<T, E> extends CustomType {
static isResult(data: unknown): boolean
isOk(): boolean
}

export type Option$<GC> = Some<GC> | None
export type Option$<I> = Some<I> | None

export class List<T> implements any {
head: T
Expand All @@ -136,9 +136,9 @@ export class CustomType {
}): this
}

export class Some<GC> extends CustomType {
constructor(argument$0: GC)
0: GC
export class Some<I> extends CustomType {
constructor(argument$0: I)
0: I
}

export class None extends CustomType {}
18 changes: 5 additions & 13 deletions dist/delay.mjs
Expand Up @@ -56,7 +56,7 @@ function all(results) {
}
__name(all, "all")

function do_length_acc(loop$list, loop$count) {
function count_length(loop$list, loop$count) {
while (true) {
let list = loop$list
let count = loop$count
Expand All @@ -69,16 +69,12 @@ function do_length_acc(loop$list, loop$count) {
}
}
}
__name(do_length_acc, "do_length_acc")
function do_length(list) {
return do_length_acc(list, 0)
}
__name(do_length, "do_length")
__name(count_length, "count_length")
function length2(list) {
return do_length(list)
return count_length(list, 0)
}
__name(length2, "length")
function do_reverse_acc(loop$remaining, loop$accumulator) {
function do_reverse(loop$remaining, loop$accumulator) {
while (true) {
let remaining = loop$remaining
let accumulator = loop$accumulator
Expand All @@ -92,13 +88,9 @@ function do_reverse_acc(loop$remaining, loop$accumulator) {
}
}
}
__name(do_reverse_acc, "do_reverse_acc")
function do_reverse(list) {
return do_reverse_acc(list, toList7([]))
}
__name(do_reverse, "do_reverse")
function reverse(xs) {
return do_reverse(xs)
return do_reverse(xs, toList7([]))
}
__name(reverse, "reverse")
function do_filter(loop$list, loop$fun, loop$acc) {
Expand Down
2 changes: 1 addition & 1 deletion manifest.toml
Expand Up @@ -3,7 +3,7 @@

packages = [
{ name = "filepath", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "EFB6FF65C98B2A16378ABC3EE2B14124168C0CE5201553DE652E2644DCFDB594" },
{ name = "gleam_stdlib", version = "0.36.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "C0D14D807FEC6F8A08A7C9EF8DFDE6AE5C10E40E21325B2B29365965D82EB3D4" },
{ name = "gleam_stdlib", version = "0.37.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "5398BD6C2ABA17338F676F42F404B9B7BABE1C8DC7380031ACB05BBE1BCF3742" },
{ name = "gleeunit", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "72CDC3D3F719478F26C4E2C5FED3E657AC81EC14A47D2D2DEBB8693CA3220C3B" },
{ name = "simplifile", version = "1.7.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "1D5DFA3A2F9319EC85825F6ED88B8E449F381B0D55A62F5E61424E748E7DDEB0" },
]
Expand Down
3 changes: 2 additions & 1 deletion scripts/build_js.sh
Expand Up @@ -8,8 +8,9 @@ cd "$(dirname $0)/.."
gleam clean
rm -rf dist/delay.mjs
rm -rf dist/delay.d.js
rm -rf dist/extras/LICENCE.comments.txt_
rm -rf dist/extras/LICENCE.txt_
gleam build --target javascript

# format input for comments.py
cat src/delay.gleam | grep pub -B 3 | grep -v "\}" | grep -v import | sed -E 's/\(.*//g' >comments.tmp

Expand Down
14 changes: 8 additions & 6 deletions scripts/pull_prelude.sh
Expand Up @@ -10,18 +10,20 @@ if [ -z "$1" ]; then
fi
VER="v$1"

http --print=b "https://raw.githubusercontent.com/gleam-lang/gleam/${VER}/LICENCE" > LICENCE._
sed -e 's/^/\/\//' LICENCE._ > LICENCE._._
http --print=b "https://raw.githubusercontent.com/gleam-lang/gleam/${VER}/LICENCE" > dist/extras/LICENCE.txt_
sed -e 's/^/\/\//' dist/extras/LICENCE.txt_ > dist/extras/LICENCE.comments.txt_
rm -rf dist/extras/LICENCE.txt_

echo "// copy of https://github.com/gleam-lang/gleam/blob/${VER}/compiler-core/templates/prelude.d.mts" > dist/extras/prelude.d.mts
echo "// ---" > dist/extras/prelude.d.mts
cat LICENCE._._ >> dist/extras/prelude.d.mts

cat dist/extras/LICENCE.comments.txt_ >> dist/extras/prelude.d.mts
http --print=b "https://raw.githubusercontent.com/gleam-lang/gleam/${VER}/compiler-core/templates/prelude.d.mts" >> dist/extras/prelude.d.mts

echo "// copy of https://github.com/gleam-lang/gleam/blob/${VER}/compiler-core/templates/prelude.mjs" > dist/extras/prelude.mjs
echo "// ---" >> dist/extras/prelude.mjs
cat LICENCE._._ >> dist/extras/prelude.mjs

cat dist/extras/LICENCE.comments.txt_ >> dist/extras/prelude.mjs
http --print=b "https://raw.githubusercontent.com/gleam-lang/gleam/${VER}/compiler-core/templates/prelude.mjs" >> dist/extras/prelude.mjs

rm -rf LICENCE._
rm -rf LICENCE._._
rm -rf dist/extras/LICENCE.comments.txt_

0 comments on commit 95e206b

Please sign in to comment.