@effect/language-service 0.14.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/index.js +531 -32
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +33 -29
- package/transform.js.map +1 -1
package/package.json
CHANGED
package/transform.js
CHANGED
|
@@ -775,23 +775,27 @@ var contextGet = (context, tag) => {
|
|
|
775
775
|
}
|
|
776
776
|
return none2();
|
|
777
777
|
};
|
|
778
|
-
var
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
}
|
|
778
|
+
var Proto = {
|
|
779
|
+
run: () => {
|
|
780
|
+
},
|
|
782
781
|
[Symbol.iterator]() {
|
|
783
782
|
return new SingleShotGen(new YieldWrap(this));
|
|
784
783
|
}
|
|
785
784
|
};
|
|
785
|
+
function make2(run2) {
|
|
786
|
+
const result = Object.create(Proto);
|
|
787
|
+
result.run = run2;
|
|
788
|
+
return result;
|
|
789
|
+
}
|
|
786
790
|
var unsafeRun = (fa) => {
|
|
787
791
|
const result = fa.run(contextEmpty);
|
|
788
792
|
switch (result._tag) {
|
|
789
793
|
case "Left":
|
|
790
|
-
return left2(result.
|
|
794
|
+
return left2(result.value);
|
|
791
795
|
case "Defect":
|
|
792
|
-
return left2(new NanoDefectException(result.
|
|
796
|
+
return left2(new NanoDefectException(result.value));
|
|
793
797
|
case "Right":
|
|
794
|
-
return right2(result.
|
|
798
|
+
return right2(result.value);
|
|
795
799
|
}
|
|
796
800
|
};
|
|
797
801
|
var run = (fa) => {
|
|
@@ -801,34 +805,34 @@ var run = (fa) => {
|
|
|
801
805
|
return left2(new NanoDefectException(e));
|
|
802
806
|
}
|
|
803
807
|
};
|
|
804
|
-
var succeed = (value) =>
|
|
805
|
-
var fail = (value) =>
|
|
806
|
-
var sync = (value) =>
|
|
807
|
-
var flatMap2 = dual(2, (fa, f) =>
|
|
808
|
+
var succeed = (value) => make2(() => ({ _tag: "Right", value }));
|
|
809
|
+
var fail = (value) => make2(() => ({ _tag: "Left", value }));
|
|
810
|
+
var sync = (value) => make2(() => ({ _tag: "Right", value: value() }));
|
|
811
|
+
var flatMap2 = dual(2, (fa, f) => make2((ctx) => {
|
|
808
812
|
const result = fa.run(ctx);
|
|
809
813
|
if (result._tag !== "Right") return result;
|
|
810
|
-
return f(result.
|
|
814
|
+
return f(result.value).run(ctx);
|
|
811
815
|
}));
|
|
812
|
-
var map3 = dual(2, (fa, f) =>
|
|
816
|
+
var map3 = dual(2, (fa, f) => make2((ctx) => {
|
|
813
817
|
const result = fa.run(ctx);
|
|
814
818
|
if (result._tag !== "Right") return result;
|
|
815
|
-
return { _tag: "Right",
|
|
819
|
+
return { _tag: "Right", value: f(result.value) };
|
|
816
820
|
}));
|
|
817
|
-
var orElse = (f) => (fa) =>
|
|
821
|
+
var orElse = (f) => (fa) => make2((ctx) => {
|
|
818
822
|
const result = fa.run(ctx);
|
|
819
|
-
if (result._tag === "Left") return f().run(ctx);
|
|
823
|
+
if (result._tag === "Left") return f(result.value).run(ctx);
|
|
820
824
|
return result;
|
|
821
825
|
});
|
|
822
|
-
var service = (tag) =>
|
|
826
|
+
var service = (tag) => make2(
|
|
823
827
|
(ctx) => contextGet(ctx, tag).pipe(match({
|
|
824
|
-
onNone: () => ({ _tag: "Defect",
|
|
825
|
-
onSome: (value) => ({ _tag: "Right",
|
|
828
|
+
onNone: () => ({ _tag: "Defect", value: `Cannot find service ${tag.key}` }),
|
|
829
|
+
onSome: (value) => ({ _tag: "Right", value })
|
|
826
830
|
}))
|
|
827
831
|
);
|
|
828
|
-
var provideService = (tag, value) => (fa) =>
|
|
832
|
+
var provideService = (tag, value) => (fa) => make2((ctx) => {
|
|
829
833
|
return fa.run(contextAdd(ctx, tag, value));
|
|
830
834
|
});
|
|
831
|
-
var gen = (...args) =>
|
|
835
|
+
var gen = (...args) => make2((ctx) => {
|
|
832
836
|
const iterator = args[0]();
|
|
833
837
|
let state = iterator.next();
|
|
834
838
|
while (!state.done) {
|
|
@@ -837,11 +841,11 @@ var gen = (...args) => new Nano((ctx) => {
|
|
|
837
841
|
if (result._tag !== "Right") {
|
|
838
842
|
return result;
|
|
839
843
|
}
|
|
840
|
-
state = iterator.next(result.
|
|
844
|
+
state = iterator.next(result.value);
|
|
841
845
|
}
|
|
842
|
-
return { _tag: "Right",
|
|
846
|
+
return { _tag: "Right", value: state.value };
|
|
843
847
|
});
|
|
844
|
-
var fn = (_) => (body) => (...args) =>
|
|
848
|
+
var fn = (_) => (body) => (...args) => make2((ctx) => {
|
|
845
849
|
const iterator = body(...args);
|
|
846
850
|
let state = iterator.next();
|
|
847
851
|
while (!state.done) {
|
|
@@ -850,17 +854,17 @@ var fn = (_) => (body) => (...args) => new Nano((ctx) => {
|
|
|
850
854
|
if (result._tag !== "Right") {
|
|
851
855
|
return result;
|
|
852
856
|
}
|
|
853
|
-
state = iterator.next(result.
|
|
857
|
+
state = iterator.next(result.value);
|
|
854
858
|
}
|
|
855
|
-
return { _tag: "Right",
|
|
859
|
+
return { _tag: "Right", value: state.value };
|
|
856
860
|
});
|
|
857
|
-
var option = (fa) =>
|
|
861
|
+
var option = (fa) => make2((ctx) => {
|
|
858
862
|
const result = fa.run(ctx);
|
|
859
863
|
switch (result._tag) {
|
|
860
864
|
case "Right":
|
|
861
|
-
return { _tag: "Right",
|
|
865
|
+
return { _tag: "Right", value: some2(result.value) };
|
|
862
866
|
case "Left":
|
|
863
|
-
return { _tag: "Right",
|
|
867
|
+
return { _tag: "Right", value: none2() };
|
|
864
868
|
case "Defect":
|
|
865
869
|
return result;
|
|
866
870
|
}
|