aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2023-01-13 20:32:20 +0530
committerAkshay Nair <phenax5@gmail.com>2023-01-13 20:33:01 +0530
commit518a6a9ee31f0b03f08cb77bc613b4d708bb640b (patch)
tree7f17ce66f337dee573192ce06a24385415048ae2 /examples
parent42f8c401dc9519bc8b2d386ce9eda072144a46d0 (diff)
downloadts-types-lang-518a6a9ee31f0b03f08cb77bc613b4d708bb640b.tar.gz
ts-types-lang-518a6a9ee31f0b03f08cb77bc613b4d708bb640b.zip
chore: prettier
Diffstat (limited to 'examples')
-rw-r--r--examples/file.ts8
-rw-r--r--examples/guess-number.ts3
-rw-r--r--examples/hello-world.ts17
-rw-r--r--examples/test-runner.ts42
4 files changed, 29 insertions, 41 deletions
diff --git a/examples/file.ts b/examples/file.ts
index fd5728b..2cc2b7a 100644
--- a/examples/file.ts
+++ b/examples/file.ts
@@ -13,11 +13,5 @@ interface ConstK<Val> extends Kind1<unknown, Val> {
export type main = [
Bind<ReadFile<'./default.nix'>, PrintK>,
- Bind<
- Try<
- ReadFile<'./unicorn'>,
- ConstK<"hello world">
- >,
- PrintK
- >,
+ Bind<Try<ReadFile<'./unicorn'>, ConstK<'hello world'>>, PrintK>
]
diff --git a/examples/guess-number.ts b/examples/guess-number.ts
index 45d60e6..6f5a31b 100644
--- a/examples/guess-number.ts
+++ b/examples/guess-number.ts
@@ -9,7 +9,8 @@ export type main = [
type Len<Ls extends any[]> = Ls['length'] extends number ? Ls['length'] : 0
-interface AskForGuess<N extends number, Attempts extends 0[]> extends Kind1<string> {
+interface AskForGuess<N extends number, Attempts extends 0[]>
+ extends Kind1<string> {
return: `${this['input']}` extends `${N}`
? PutStringLn<'Yay! You got it right!'>
: Do<
diff --git a/examples/hello-world.ts b/examples/hello-world.ts
index fcdb8e9..9d2bc18 100644
--- a/examples/hello-world.ts
+++ b/examples/hello-world.ts
@@ -1,20 +1,13 @@
-import { Bind, Do, Kind1 } from "../stdlib/effect";
-import { CreateRef, GetRef, Ref, SetRef } from "../stdlib/ref";
-import { Print } from "../stdlib/stdio";
+import { Bind, Do, Kind1 } from '../stdlib/effect'
+import { CreateRef, GetRef, Ref, SetRef } from '../stdlib/ref'
+import { Print } from '../stdlib/stdio'
interface PrintK extends Kind1 {
return: Print<this['input']>
}
interface Func extends Kind1<Ref> {
- return: Do<[
- SetRef<this['input'], 69>,
- Bind<GetRef<this['input']>, PrintK>,
- ]>
+ return: Do<[SetRef<this['input'], 69>, Bind<GetRef<this['input']>, PrintK>]>
}
-export type main = [
- Bind<CreateRef<200>, Func>,
- Print<1>,
-]
-
+export type main = [Bind<CreateRef<200>, Func>, Print<1>]
diff --git a/examples/test-runner.ts b/examples/test-runner.ts
index 081dede..7dc1966 100644
--- a/examples/test-runner.ts
+++ b/examples/test-runner.ts
@@ -4,37 +4,37 @@ import { SetEvalEnvironment } from '../stdlib/sys'
import { Test, Assert } from '../stdlib/test'
import { Equals, Not } from '../stdlib/util'
-type testSomeStuff = Do<[
- PutStringLn<"Some Stuff">,
+type testSomeStuff = Do<
+ [
+ PutStringLn<'Some Stuff'>,
- Test<"should do some stuff", [
- Assert<Equals<1, 1>>,
- Assert<Not<Equals<2, 1>>>,
- ]>,
+ Test<
+ 'should do some stuff',
+ [Assert<Equals<1, 1>>, Assert<Not<Equals<2, 1>>>]
+ >,
- Test<"bing bong, bing bing bong", [
- Assert<Equals<1, 1>>,
- ]>,
-]>
+ Test<'bing bong, bing bing bong', [Assert<Equals<1, 1>>]>
+ ]
+>
-type testSomeMoreStuff = Do<[
- PutStringLn<"Other stuff?">,
+type testSomeMoreStuff = Do<
+ [
+ PutStringLn<'Other stuff?'>,
- Test<"should do some other stuff", [
- Assert<Equals<[1, 2, 3], [1, 2, 3]>>,
- ]>,
+ Test<'should do some other stuff', [Assert<Equals<[1, 2, 3], [1, 2, 3]>>]>
- // Test<"this'll fail fo sho", [
- // Assert<Equals<[1, 2, 3], [4, 5, 6]>>,
- // ]>,
-]>
+ // Test<"this'll fail fo sho", [
+ // Assert<Equals<[1, 2, 3], [4, 5, 6]>>,
+ // ]>,
+ ]
+>
export type main = [
// Update env to node with test helpers
SetEvalEnvironment<'test.node'>,
- PutStringLn<"=== Running tests... ===\n">,
+ PutStringLn<'=== Running tests... ===\n'>,
testSomeStuff,
- testSomeMoreStuff,
+ testSomeMoreStuff
]