import { left } from "https://deno.land/x/fun@v2.0.0/optic.ts";
A preconstructed composed prism that focuses on the Left value of an Either.
Examples
Example 1
Example 1
import * as O from "./optic.ts";
import * as E from "./either.ts";
import { pipe } from "./fn.ts";
type Response = E.Either<Error, string>;
const value = pipe(O.id<Response>(), O.left);
const result1 = pipe(value, O.view(E.right("Good job!")));
// None
const result2 = pipe(value, O.view(E.left(new Error("Something broke"))));
// Some(Error("Something broke"))