Trouble Evaluating Effects with `Template` in `@effect/platform`
QQ: Trying to work with
TemplateTemplate in @effect/platform@effect/platform. I can't seem to get the Effects to evaluate like the tests show. Am I missing something?const getComponent = (componentName: string) =>
Effect.gen(function* () {
if (rawComponentMap.has(componentName)) {
return yield* Template.make`${rawComponentMap.get(componentName)}`;
}
const fs = yield* FileSystem.FileSystem;
const componentTemplate = yield* fs
.readFileString(`src/server/components/${componentName}.html`, "utf8")
.pipe(
Effect.catchAll(() =>
Effect.gen(function* () {
yield* Effect.logError(
`Cannot find template file for component: ${componentName}`
);
})
)
);
if (componentTemplate) {
rawComponentMap.set(componentName, componentTemplate);
}
const rawComponent = rawComponentMap.get(componentName);
if (!rawComponent) return null;
return yield* Template.make`${rawComponent}`;
}).pipe(Effect.provide(NodeFileSystem.layer));const getComponent = (componentName: string) =>
Effect.gen(function* () {
if (rawComponentMap.has(componentName)) {
return yield* Template.make`${rawComponentMap.get(componentName)}`;
}
const fs = yield* FileSystem.FileSystem;
const componentTemplate = yield* fs
.readFileString(`src/server/components/${componentName}.html`, "utf8")
.pipe(
Effect.catchAll(() =>
Effect.gen(function* () {
yield* Effect.logError(
`Cannot find template file for component: ${componentName}`
);
})
)
);
if (componentTemplate) {
rawComponentMap.set(componentName, componentTemplate);
}
const rawComponent = rawComponentMap.get(componentName);
if (!rawComponent) return null;
return yield* Template.make`${rawComponent}`;
}).pipe(Effect.provide(NodeFileSystem.layer));