[HN Gopher] TypeCell, open source TypeScript notebooks live prog...
___________________________________________________________________
TypeCell, open source TypeScript notebooks live programming
environment
Author : throwaway888abc
Score : 93 points
Date : 2023-06-13 20:22 UTC (1 days ago)
(HTM) web link (www.typecell.org)
(TXT) w3m dump (www.typecell.org)
| reuben364 wrote:
| Trying out the thing, and since this is ycombinator after all:
| type Lazy<A> = () => A; const lazy = <A,>(f: Lazy<A>) => {
| let thunk: Lazy<A> = () => { throw null; } thunk = () =>
| { const y = f(); thunk = () => y
| return y; }; return thunk; }; const
| tap = <A,B>(f: Lazy<(a: Lazy<A>) => Lazy<B>>, a: Lazy<A>):
| Lazy<B> => lazy(() => f()(a)()); const ap =
| (f: any, a: any): any => tap<any,any>(f, a); const y
| = <A,>(f : (a: Lazy<A>) => Lazy<A>): Lazy<A> => ap(((x: any) =>
| ap(ap(f, x), x)),((x: any) => ap(ap(f,x),x))); type
| Cat = { name: string, friend: Cat,
| prefersDryFood: boolean, foodPerWeek: number };
| export const cat = y<Cat>(self => lazy(() => ({ name:
| "lol", friend: self(), prefersDryFood: false,
| foodPerWeek: 4, })))();
|
| Breaks typescript though. Also, the laziness won't work here.
| compressedgas wrote:
| Though you need to replace: return thunk;
|
| with: return () => thunk();
|
| Otherwise the assignment in thunk does nothing.
| reuben364 wrote:
| Whoops, forgot to eta expand.
| purplecats wrote:
| so, observablehq. i like it. what's the pricing, and can you save
| private docs?
| steve_adams_86 wrote:
| Observable doesn't have TypeScript support, which is a real
| drag. Their embeds also don't show code, so it's not very
| useful as a teaching tool in a blog post for example. However,
| they don't charge for embedding, so that's not a problem per
| se.
| amitport wrote:
| So many of these projects over the years. There's zero profit to
| be made here IMHO. Though it would be cool if somebody manage to
| crack the formula, I don't see how this specific project does
| that.
| hardwaresofton wrote:
| The future continues to be AGPL[0].
|
| [0]: https://vadosware.io/post/the-future-of-free-and-open-
| source...
| vinnymac wrote:
| First demo I tried was `Visualize weather data with two React
| chart libraries`, and all I see is an error at the bottom.
|
| > Something went wrong: TypeError: Cannot read properties of null
| (reading 'useRef')
|
| Appears to be an issue with the charting library used here at a
| glance?
| oofsa wrote:
| Cool. This may be a bit nitpicky, but most of the interactive
| JavaScript environments I have seen with auto-run ("evaluates as-
| you-type"), including this one, freeze in the following case.
| for (let i = 0; i < 10;|) {} ^
| cursor
| civilitty wrote:
| An easy way to correct this is injecting a watchdog function
| call at the end of every for and while loop. It's a trivial AST
| transformation that's relatively fool proof as opposed to
| trying to figure out what condition would progress the loop.
| The semantics of the watchdog depend on the use case and
| ideally you can transform the evaled code in an async wrapper.
| Set a global variable to the current time on animation frames
| and then throw an exception inside the watchdog when it times
| out (when difference between the global variable and current
| time is > x ms).
| Timon3 wrote:
| No problem, there's an NPM package for that!
|
| (no, I'm not kidding: https://www.npmjs.com/package/halting-
| problem)
| simlevesque wrote:
| One of the great mysteries of life is why Microsoft doesn't
| provide a good TypeScript notebook for VsCode. The JS notebook
| plugin is like a toy.
| iddan wrote:
| Especially after building two alpha products
| jasmcole wrote:
| Nice! I made a quick'n'dirty Typescript notebook with React +
| Plotly as a Matlab clone a few years ago. I was impressed with
| how everything you need to compile and execute TS was built-in to
| Monaco, using web workers etc.
|
| https://jasmcole.com/2021/05/19/matslab/
|
| https://jasmcole.github.io/Pages/MaTSlab
| bhaybs wrote:
| I have been waiting a long for this
|
| I use Quokka.js but I hate that the free version is almost
| useless
| FractalHQ wrote:
| They rebranded it into "console ninja", with a more generous
| (and actually (extremely) useful) free tier for the extension.
| I can highly recommend it!
| highmastdon wrote:
| I'd like to see this as a live code-sharing tool. Sometimes when
| interviewing candidates I'm using codeshare.io, but that doesn't
| have "live compilation". This would be great for that. I'm
| missing some features, and they're expected as it's in alpha, but
| I don't want to keep them from you: 1. vim mode (ace editor could
| be nice for this?), 2. a way to share with a not logged-in user
| 3. dark mode 4. maybe I'm missing it, but having a `console.log`
| not being in the output is unintuitive
| qznc wrote:
| "Running code has never been easier :)"
|
| Well... _presses Ctrl-Shift-i_ ...I found an easier way to run
| some code :)
| pitaj wrote:
| F12 is even easier
| fragmede wrote:
| it's off the home row, and isn't available on Apple keyboards
| by default without also using the Fn modifier, at which point
| it's only different by one keystroke, not two.
| steve_adams_86 wrote:
| I don't seem to be clever enough to figure out importing from
| NPM. The docs indicate that you don't need to do anything
| special, but all of my attempts yield "Error: couldn't resolve
| module [module name]". I can however import from other notebooks,
| and that's very cool: https://www.typecell.org/@steveadams/test
___________________________________________________________________
(page generated 2023-06-14 23:01 UTC)