aboutsummaryrefslogtreecommitdiff
path: root/src/index.ts
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2023-01-05 18:49:34 +0530
committerAkshay Nair <phenax5@gmail.com>2023-01-05 18:49:34 +0530
commit9842f84ecd47011149c928287e63fb5de399e161 (patch)
treecd243838ac7cba673d053855b3818b9ec0b4b3a6 /src/index.ts
parent1e2b8780906744ad51248ee7021bd5d1d1e86ebb (diff)
downloadts-types-lang-9842f84ecd47011149c928287e63fb5de399e161.tar.gz
ts-types-lang-9842f84ecd47011149c928287e63fb5de399e161.zip
feat: js expr in types now. aaaa. kill me pliz
Diffstat (limited to 'src/index.ts')
-rw-r--r--src/index.ts22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/index.ts b/src/index.ts
index f7e00b7..6097752 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -3,13 +3,17 @@ export type Effect = EffectAtom[]
export interface PrintString<_ extends string> extends EffectAtom { }
export interface Print<_ extends any> extends EffectAtom { }
-// interface Debug<_ extends string, T> extends EffectAtom<T> { }
+export interface Debug<_ extends string, T> extends EffectAtom<T> { }
export interface WriteFile<_Path extends string, _Content extends string> extends EffectAtom { }
export interface ReadFile<_Path extends string> extends EffectAtom<string> { }
export interface GetEnv<_Name extends string> extends EffectAtom<string> { }
+export interface ReadLine extends EffectAtom<string> { }
+
+export interface JsExpr<_Expr extends string> extends EffectAtom<any> {}
+
export interface Program<Effs extends Effect, ExitCode extends number = 0> {
effects: Effs,
exitCode: ExitCode,
@@ -25,13 +29,21 @@ export interface ChainIO<Eff extends EffectAtom, Fn extends Kind1> extends Effec
chainTo: Fn
}
-export interface PrintK extends Kind1<string | undefined> {
- return: Print<this['input']>
+interface PrintK<Label extends string = ""> extends Kind1<unknown> {
+ return: Debug<Label, this['input']>
}
+// interface WithInputK extends Kind1<string> {
+// return: ChainIO<ReadLine, PrintK<this['input']>>
+// }
+
+// ChainIO<ReadLine, WithInputK>,
+// ChainIO<ReadFile<"./default.nix">, PrintK>,
+// Print<"Your name?:">,
+// ChainIO<ReadLine, PrintK<"Hello,">>,
+
export type main = Program<[
[1, 2, 3] extends infer Res ? Print<Res> : never,
- Print<`wow: ${string} -> ${'helo'}`>,
ChainIO<GetEnv<"NODE_ENV">, PrintK>,
- ChainIO<ReadFile<"./default.nix">, PrintK>,
+ ChainIO<JsExpr<"{ boobaa: [5 * 3, 5 * 2] }">, PrintK>,
]>