aboutsummaryrefslogtreecommitdiff
path: root/src/index.ts
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2023-01-04 18:44:00 +0530
committerAkshay Nair <phenax5@gmail.com>2023-01-04 18:44:00 +0530
commit5f5ea35c634cd97710eb953f930cc4d468c948ce (patch)
tree99beefc65071e20e6bb5b3e3a2345d5d737603b0 /src/index.ts
parentfb91cf7218f20bdb8896a2ea305aa598f9f07036 (diff)
downloadts-types-lang-5f5ea35c634cd97710eb953f930cc4d468c948ce.tar.gz
ts-types-lang-5f5ea35c634cd97710eb953f930cc4d468c948ce.zip
feat: pics send quick. runtime with effects donezo
Diffstat (limited to 'src/index.ts')
-rw-r--r--src/index.ts39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/index.ts b/src/index.ts
index e69de29..accde98 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -0,0 +1,39 @@
+export interface EffectAtom<T = unknown> { output: T }
+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 WriteFile<_Path extends string, _Content extends string> extends EffectAtom { }
+export interface ReadFile<_Path extends string> extends EffectAtom<string> { }
+
+export interface Program<Effs extends Effect, ExitCode extends number = 0> {
+ effects: Effs,
+ exitCode: ExitCode,
+}
+
+export interface Kind<Inp = unknown, Out = unknown> {
+ input: Inp
+ return: Out
+}
+
+export interface WriteFileC extends Kind<string> {
+ return: WriteFile<"./somefile.txt", this['input']>
+}
+
+export interface ChainIO<Eff extends EffectAtom, Fn extends Kind> extends EffectAtom {
+ input: Eff
+ chainTo: Fn
+}
+
+export type main = Program<[
+ [1, 2, 3] extends infer Res ? Print<Res> : never,
+ Print<"bye bye">,
+ ReadFile<"./.gitignore">,
+
+ ChainIO<
+ ReadFile<"./default.nix">,
+ WriteFileC
+ >,
+]>