The fetching computation.
import { ask, map, Reader, run } from "./reader.ts";
import { cat } from "./cat.ts";
import { assertEquals } from "../deps.ts";
interface User {
name: string;
}
const message = (): Reader<User, string> =>
cat(ask<User>()).feed(map(({ name }) => `Hello, ${name}!`)).value;
const box = (): Reader<User, string> =>
cat(message()).feed(
map((mes) => `<div class="message-box">${mes}</div>`),
).value;
assertEquals(
run(box())({ name: "John" }),
'<div class="message-box">Hello, John!</div>',
);
assertEquals(
run(box())({ name: "Alice" }),
'<div class="message-box">Hello, Alice!</div>',
);
Generated using TypeDoc
Fetches the record of the environment.