HNHacker News
TopNewBestAskShowJobs

sfvisser

1,394 karma · joined November 10, 2009

hn@fvisser.nl http://monumental.co
submissionscomments
sfvisser··on Functional programming with bananas, lenses, envelopes and barbed wire [pdf] (1991)
These patterns might seem abstract and obscure at first, but have proven tremendously powerful in practice to me.

The current project I’m working on in Rust has a big recursive data type with quite some branches and different instantiations of recursive positions. Box/Vec/Option etc.

By parametrizing the enum with a type variable and tying the knot with a type level fixed point combinator gives you back the originally intended data type. But now suddenly you can put annotations in the recursive positions as well, use generic cata/para and other higher level combinators. Fun and powerful stuff!

(The lack of HKT in Rust can be challenging, but it’s mostly easy to work around it)

sfvisser··on Functional programming with bananas, lenses, envelopes and barbed wire [pdf] (1991)
That definition is just one of the many possible definitions. And one of the obscurer ones tbh. :)

It’s an abstract concept that you can implement in many different ways.

sfvisser··on JavaScript Garbage Collection with WebAssembly Is Possible Today
Don't think your comment makes a lot of sense in the context of the article. Author explicitly wants to create/use/drop some WASM instances in the JavaScript world without leaking memory. Piggybacking on the existing JS GC is perfectly reasonable approach here.
sfvisser··on The Dunning-Kruger Effect Is Autocorrelation
My intuition for this is: given a fixed and known scoring range (say 0..100), when scoring very low there is simply a lot of room for overestimating yourself and when scoring very high there is simply a lot of room for underestimating yourself. So all noise ends up adding to the inverse correlation naturally.
sfvisser··on Concatenative Language
Interesting related paper by Jeroen Fokker: The Systematic Construction of a One-Combinator Basis (1989)

https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.19....

sfvisser··on Why don't more languages offer flow typing?
Definitely yes!

It's a loooong time ago, but the pattern exhaustiveness checker of GHC wasn't up to this last time I tried. But my guess is things are much better now and this might actually work.

sfvisser··on Why don't more languages offer flow typing?
Contrary to what many comments here state, I don’t think this is only useful in a dynamic runtime kind-of environment. I often think I could use some form of this in Rust and/or Haskell. In a very specific way:

I often want a single constructor/branch of an enum (sum type) to a be a type as well, specifically a sub-type of the full enum. So once I learn about what branch a value is, I can treat it like that and even first class pass it around – without unpacking.

I think this should be implementable in Rust without any runtime overhead as pure syntactic sugar. You get the same effect by creating a new struct for every set of values per branch and using those wrappers instead.

sfvisser··on Two Vexing Problems in Functional Programming
> Functional program­ming, however, suggests we should create and destroy these struc­tures willy-nilly.

It really saddens me that some people completely miss the point of what FP is about.

How did this happen?

sfvisser··on How to compare floats in Python
You’re right here I think, but it is a hard problem in practice I noticed. Hard in the engineering sense, because you’re sometimes writing generic library-level code that needs a domain specific notion of error bars and tolerances. So you need to parametrize everything, sometimes for multiple dimensions. Becomes messy quickly.

I must admit putting a mystery epsilon in my code here and there for that reason. Admittedly the wrong thing to do.

sfvisser··on Are there limits to economic growth?
No, we’re always at the beginning of infinity.
sfvisser··on Advice on JSX Conditionals
True. Also many of these are not actual issues and are just behavior inherent to using JavaScript.

If you don’t like your conditional logic in your template just give them a name and explicit boolean type and be done with it.

Still a useful overview of common idioms though for people who just get started.

sfvisser··on MLOps is a mess but that's to be expected
Maybe I’m a bit naive, but I’m convinced any great traditional software engineer or devops engineer in combination with a data scientist/ML person should be able to setup the ops pipeline for a ML project. The details and algorithms themselves may look new and exciting, but operationalizing algorithms isn’t a totally new thing.
sfvisser··on The File System Access API with Origin Private File System
I don’t think that’s the natural conclusion per se. The feature is just spec’ed from one side, the webapp side. It’s up to the browsers to implement some export feature to expose it to the system side. Maybe some simple generic browser extension can provide an export-as-zip feature.

There are still ways how this will not end in closed black-boxes.

sfvisser··on Haskell error messages: come on
The errors used to be somewhat better in the past, but more features have been added to the language, type system and std libs. Those features required the core parts to be slightly more expressive and generic, resulting in more abstract error messages.

Not great, but I think there are definitely no easy fixes here.

sfvisser··on Back-end languages are coming to the front-end
I don't think this is really about programming languages. The world of software (and specifically everything network based) is oscillating between fat servers and fat client every few years or so. To me the innovation seems to be orthogonal to this cycle and may actually be accelerated by this continuous change in perspective. Which is good!
sfvisser··on Rome Formatter and Rust Update
> But why create a new formatter? When we began our Rust rewrite, we fell in love with rustfmt, Rust’s own formatter. It formatted code instantly, unlike JavaScript formatters which could often take quite a few seconds on larger files.

I write quite a bit of Rust and quite a bit of TypeScript and use both rustfmt and prettier. I really like both tools, but don’t think rustfmt is much faster honestly. I would probably say prettier in VSCode feels a bit more responsive.

sfvisser··on CadQuery Comes of Age
What’s crazy about it? And how would contexts by more ergonomic than method chaining? Hard to imagine honestly.

You can always use intermediate variables if you want to.

sfvisser··on High-order Virtual Machine (HVM): Massively parallel, optimal functional runtime
My guess is the author just picked the simplest syntax to parse in order to demonstrate the tech. If it works and shows to be successful you can always write a GHC (or whatever) backend that compiles to this runtime. Maybe come up with some binary IL etc
sfvisser··on An introduction to type programming in TypeScript
Type variables are sometimes called generics and a part of the type language, so JavaScript doesn’t have them. Typescript, but also Rust, Haskell, Java, the ML-family have them.

Type variables abstract over types and are analogous to function parameters at the values level. Think the ‘T’ in ‘List<T>’.

sfvisser··on An introduction to type programming in TypeScript
The article seems to be mixing up type synonyms with type variables. Type variables have an actual well defined meaning. They act like variables that can be instantiated during inference/checking, analogue to how variables in the expression language get instantiated at runtime.
sfvisser··on Using tree data structures to implement terminal split panes
But a zipper on a tree I assume.
sfvisser··on A pipe operator for JavaScript: introduction and use cases
It's easier to see what's going on when you consider the spread operator to be an operator working on the function not the parameters:

    const dotdotdot = <A>(f: Function) => (list: Array<A>) => f.apply(this, list)

    dotdotdot(console.log)([10, 20, 30])
    console.log(...[10, 20, 30])
sfvisser··on A pipe operator for JavaScript: introduction and use cases
I think this argument makes sense in _some_ usecases, but definitely not everywhere.

There are genuine places where a FP approach to API/DSL design makes sense and writing code that abstracts away from concrete parameters and focuses on composition is important. Operators for function application and composition can now be used for a similar concepts on a higher level of abstraction.

Suddenly 'esoteric' syntax helps clarify your code and forces you to focus on meaning and intent, not syntactic details of your PL.

sfvisser··on Nova by Panic
VSCode’s speed and resource usage are not best class, but – on my relatively modern machine – are definitively good enough.
sfvisser··on Parcel CSS: A new CSS parser, compiler, and minifier
You are right and I phrased my comment the wrong way.

The confusing part is not calling this process compilation, the confusing part is now calling something a compiler for which the consensus previously was calling it a pre-processor. Now I started to wonder if there is something new that I wasn't aware off, like a browser support optimized binary style format that we can compile into.

sfvisser··on Parcel CSS: A new CSS parser, compiler, and minifier
This is not about elitism about terminology, but about sloppiness in using well established words in a specific context to mean something new. It happens rather frequently in the frontend world - which I’m sometimes a part of - and it’s incredibly confusing to all of us.
sfvisser··on Parcel CSS: A new CSS parser, compiler, and minifier
I've obviously read that. Most of those features are what we used to call CSS pre-processors, but I'll happily call that compilation if that's a thing now.
sfvisser··on Parcel CSS: A new CSS parser, compiler, and minifier
What does it mean to compile CSS? Pack multiple files into one? Resolve and inline variables? Convert nested rules into flat CSS? Something else?

I'm really not sure.

sfvisser··on Hang your code out to DRY
Abstraction is inherently not about deduplication, it is about capturing intent and meaning. About the universality of certain concepts within your code base. Either based on your problem domain or in the context of your application architecture.

Once you abstract only to shorten your code you’ll likely regret it quickly.

sfvisser··on Pinning in Plain English
Nearly all my confusion is gone. This is amazing, thanks!
← PreviousPage 4 of 11Next →