hi
- User
hi
- Assistant
Hello! How can I help you today?
- User
- Assistant
That's impressive that you built your own React-like rendering library from scratch! Including a project like that on your resume can definitely catch the eye of recruiters and hiring managers, especially for roles involving frontend engineering or frameworks/library development.
- User
this is the whole framework im building export { type Maybe, Just, Nothing } from "./Kinds/Maybe"; export { type Either, Left, Right } from "./Kinds/Either"; export { type List, Cons, Nil } from "./Kinds/List"; export { Reader } from "./Kinds/Reader"; export { Future } from "./Kinds/Future"; export { Signal } from "./Kinds/Signal"; export { State } from "./Kinds/State"; export { Box } from "./Kinds/Box"; export { Try } from "./Kinds/Try"; export { IO } from "./Kinds/IO";
export { Render, type FC } from "./Render/Render"; export { Root } from "./Render/Root";
export { DraggableAndResizable } from "./DOM/DraggableAndResizable"; export { Animate } from "./DOM/Animate"; export { HTML } from "./DOM/HTML"; export { CSS } from "./DOM/CSS"; export { } from "./DOM/";
export { PrettyPrint } from "./Utils/PrettyPrint"; export { Timeout } from "./Utils/Timeout"; export { Compose } from "./Utils/Compose"; export { Memo } from "./Utils/Memo"; export { Pipe } from "./Utils/Pipe"; export { Rnd } from "./Utils/Rnd";
export { Test, Expect, ToBe } from "./Testing/Test"; export { MockFetch } from "./Testing/MockFetch"; export { DeepEqual } from "./Testing/DeepEqual"; export { Perf } from "./Testing/Perf";
export { DevTools } from "./DevTools/Root";
- Assistant
- User
it works fine import { FC, Render, Root, Signal, CSS, HTML, IO, Reader, Timeout, } from "./lib/index";
const counterCSS = CSS({ width: "10rem", height: "10rem", backgroundColor: "rebeccapurple", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: "1rem", });
const Display: FC<{ count: Signal; rerender: Signal }> = ({ count, rerender, }) => { return Render(() => { if (count.ref() === 7) { count.set((x) => x + 1); rerender.trigger(); } return HTML("output", count.ref()); }, [count]); };
const Counter: FC<{ count: Signal }> = ({ count }) => { let io = IO(async () => { await Timeout(300); console.log("effect"); return () => { console.log("cleanup"); }; }); return Render(() => { return HTML("button", count.ref(), { onclick: () => { count.set((x) => x + 1); }, }); }, [io, count]); };
const Wrap: FC<{}> = () => { const count = Signal(0); const rerender = Signal(0);
return Render(() => { return HTML( "main", counterCSS, Display({ count, rerender }), Counter({ count }), ); }, [rerender]); };
Root(document.body, () => Wrap({}));
- Assistant
Thanks for sharing this example usage — it nicely demonstrates how your framework's core abstractions like , , , , and come together to build reactive UI components with effects and lifecycle cleanup!
- User
the io is just a simple wrapper with standard monad methods interface IO { kind: "IO"; ex: () => E; map: (f: (a: E) => F) => IO; chain: (f: (a: E) => IO) => IO; extract: () => () => E; }
interface TypeConstructor<K extends IO> { (thunk: () => E): IO; of: (thunk: () => E) => IO; id: () => IO; }
const IO: TypeConstructor<IO> = (thunk) => ({ kind: "IO", map: (f) => IO(() => f(thunk())), chain: (f) => IO(() => f(thunk()).ex()), ex: () => thunk(), extract: () => thunk, }) as const;
IO.of = (thunk) => IO(thunk); IO.id = () => IO(() => {});
export { IO };
- Assistant
Thanks for sharing the implementation of your
IOmonad! This is a clean, minimal, and well-typed design following functional programming principles, which adds a powerful abstraction for managing side effects in your framework. - User
is this ok? interface Signal { kind: "Signal"; ref: () => S; set: (f: (s: S) => S) => void; sub: (f: (s: S) => void) => () => void; trigger: () => void; extract: () => S; }
interface TypeConstructor<K extends Signal> { <S = undefined>(s?: S): Signal; of: <S = undefined>(s?: S) => Signal; id: () => K; }
const Signal: TypeConstructor<Signal> = <S = undefined>( s?: S, ): Signal => { const observers = new Set<(s: S) => void>(); return { kind: "Signal", ref: () => s as S, set: (f) => { s = f(s as S); observers.forEach((f) => f(s as S)); }, sub: (f) => { observers.add(f); return () => observers.delete(f); }, trigger: () => observers.forEach((f) => f(s as S)), extract: () => { observers.clear(); return s as S; }, }; };
Signal.of = (s) => Signal(s); Signal.id = () => Signal();
let a = Signal();
export { Signal };
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.