Live data from Hacker News

Hazel: A live functional programming environment featuring typed holes

hazel.org

71–80 of 88 posts

Re: Hazel: A live functional programming environment featuring typed holes

#71
post #55

Earlier quoted context omitted.

Isn’t this possible with any untyped language? It does sound like a good feature though - very few languages have opt-out type checking. This is much better than opt-in IMO.

Hazel will also run incomplete programs around holes. Most untyped languages will just crash as soon as something is incomplete.

Laziness would be enough for this case, Haskell will happily run your programs around undefined

Re: Hazel: A live functional programming environment featuring typed holes

#72

Earlier quoted context omitted.

func TestWhatever(t *testing.T) { // ...lots of code _, _, _, _, _, _, _ = resp3, resp4, fooBefore, subFoo, bar2, barNew, zap2 } Like, I get it, it's a good feature, it caught quite a lot of typos in my code but can I please get an option to turn this checking off e.g. in unit tests? I just want to yank some APIs, look at their behaviour, and tinker a bit with the data.

The good news is if you use Nix or Guix it’s relatively easy to hack your local build of the compiler to demote the unused variables hard error to just a warning.

You know, for some weird reason, it never crossed my mind to hack the Go compiler to let me do things like that. And it's such a great idea.

Re: Hazel: A live functional programming environment featuring typed holes

#73
post #36

Earlier quoted context omitted.

That sounds like an incredibly useful feature. Do you recall what version you were using?

I believe that Eclipse 2.x already had most of these features, but it certainly was in almost all 3.x versions as far as I remember. That IDE was amazingly far ahead of its time. Even 20 years later, tools like VS Code feel like a shocking regression in capabilities to me.

This sounds like the sort of feature that will show up in a "vintage software" youtube video essay in a few years. I kinda want to go find it and give it a whirl.

Re: Hazel: A live functional programming environment featuring typed holes

#74

Earlier quoted context omitted.

The good news is if you use Nix or Guix it’s relatively easy to hack your local build of the compiler to demote the unused variables hard error to just a warning.

You know, for some weird reason, it never crossed my mind to hack the Go compiler to let me do things like that. And it's such a great idea.

[deleted]

Re: Hazel: A live functional programming environment featuring typed holes

#75

Earlier quoted context omitted.

The good news is if you use Nix or Guix it’s relatively easy to hack your local build of the compiler to demote the unused variables hard error to just a warning.

You know, for some weird reason, it never crossed my mind to hack the Go compiler to let me do things like that. And it's such a great idea.

This patch is working for me. Good luck!

https://gist.github.com/umanwizard/9793393083a42db933579fe21...

Re: Hazel: A live functional programming environment featuring typed holes

#76

This is semi-related to one of the killer features of Eclipse that never really made it into any large-scale systems: the ability to run incomplete or broken code. The Eclipse Compiler for Java had a special feature that it could generate bytecode for nearly any file, including those that were utterly broken. It would mostly work, and you could incrementally work on unit tests alongside the code being developed. It w…

embedded agile mode

Re: Hazel: A live functional programming environment featuring typed holes

#77

Earlier quoted context omitted.

Typescript has a hole type too implemented in fp-ts and effect-ts. Super useful for when you don't know what are you missing and get a type signature for it. It's mostly useful for when you declare some `const foo: (bar: Bar) => Whatever` and in the midst of your implementation you don't know what you're missing. Requires an advanced level in TS to be used to the max. https://gcanti.github.io/fp-ts/modules/function.t…

I’m struggling to understand the use, do you have a concrete example?

Suppose you declare some:

const transformFoo: (foos: Foo[]) => Bar

and you start implementing it and get stuck with some callback or whatever you can put a `hole` and it will tell you the type signature of what you're missing.

Re: Hazel: A live functional programming environment featuring typed holes

#78

I tried the playground on my Android phone and none of the key presses get through to the source code. I can position the cursor by tapping and I get a virtual keyboard but I can't type anything. Is this a bug or am I just missing something because If terrible UX?

its a bug. we should be clearer that we dont 'officially' support mobile yet (in that no-one regularly tests with it) but the no keyboard insertion thing is a chrome-specific issue (it works on firefox but there are other issues there)

Re: Hazel: A live functional programming environment featuring typed holes

#79

Earlier quoted context omitted.

func TestWhatever(t *testing.T) { // ...lots of code _, _, _, _, _, _, _ = resp3, resp4, fooBefore, subFoo, bar2, barNew, zap2 } Like, I get it, it's a good feature, it caught quite a lot of typos in my code but can I please get an option to turn this checking off e.g. in unit tests? I just want to yank some APIs, look at their behaviour, and tinker a bit with the data.

The good news is if you use Nix or Guix it’s relatively easy to hack your local build of the compiler to demote the unused variables hard error to just a warning.

Well, it's about as easy without neither Nix not Guix.

Re: Hazel: A live functional programming environment featuring typed holes

#80

Earlier quoted context omitted.

func TestWhatever(t *testing.T) { // ...lots of code _, _, _, _, _, _, _ = resp3, resp4, fooBefore, subFoo, bar2, barNew, zap2 } Like, I get it, it's a good feature, it caught quite a lot of typos in my code but can I please get an option to turn this checking off e.g. in unit tests? I just want to yank some APIs, look at their behaviour, and tinker a bit with the data.

This example isn't particularly good code. If you've got "lots of code" that names a bunch of variables (e.g. using ':=') that are never referenced AND you have a good reason not to do so (which I doubt: given this context it looks like an incomplete test), then predeclare these 'excess' variables: func TestWhatever(t *testing.T) { var resp3, resp4, fooBefore, subFoo, bar2, barNew, zap2 theirType // ...lots of code }…

This is not a piece of code I would commit, obviously! It's a piece of code in the middle of being written and re-written (and re-run, a la REPL), and constantly replacing "resp2" with "_" and back again with "resp2" is friction. Go doesn't have REPL but having a TestWhatever(t *testing.T) function is a mostly good enough replacement, except for this one small problem.
Post reply on HN