HNHacker News
TopNewBestAskShowJobs

steinuil

1,047 karma · joined April 23, 2016

I tend fat-finger the "flag" button a lot on my phone, sorry about that!
submissionscomments
steinuil··on Friendship Forever
In Italy it's fairly common for people of the same sex to greet each other with two kisses on the cheeks or hug each other. Holding hands has become kind of taboo but I don't really see the behavior of the men in those picture as inherently gay. I agree with the article that it's sad that this closeness has gone away, but it's kind of a self-inflicted problem. Men should learn not to be this homophobic and accept a bit of sane homoeroticism into their straight friendships.
steinuil··on What’s so great about functional programming anyway?
I did acknowledge that they are orthogonal when I said that not every pure FP language has to be like that. Thanks for pointing out ZIO, I didn't know about it.
steinuil··on What’s so great about functional programming anyway?
I have to agree with you as far as pure functional programming goes. I also don't like the Haskell approach of of overgeneralizing concepts just because you can; it's the FP equivalent of stuffing every design pattern you can into your OO code. I'd argue that not every pure functional programming language has to be like that but I'm pretty sure all the ones that exist are.
steinuil··on What’s so great about functional programming anyway?
I'm a fan of functional programming but I'm pretty sure this post would do a terrible job of convincing anyone to try FP out. There's a very bad pattern of replicating very specific language features and control flow structures just to make them more similar to point-free Haskell, which is not going to win anybody over.

The author begins by replacing a language feature, the . operator, with a pipe() function. After that they swap out exceptions for Result, null/undefined for Maybe, Promise with Task, and the final code ends up becoming an obfuscated mess of wrapper functions and custom control flow for what you could write as:

    fetch(urlForData)
      .then(data => data.json())
      .then((notifications) =>
        notifications.map((notification) => ({
          ...notification,
          readableDate: new Date(notification.date * 1000).toGMTString(),
          message: notification.message.replace(/</g, '&lt;'),
          sender: `https://example.com/users/${notification.username}`,
          source: `https://example.com/${notification.sourceType}/${notification.sourceId}`,
          icon: `https://example.com/assets/icons/${notification.sourceType}-small.svg`,
        })
      )
      .catch((err) => { console.log(err); return fallback });
...which is just as functional because doesn't involve any mutation and it doesn't require several pages of wrapper functions to set up, you can tell what it does at a glance without having to look up any other pieces of code, it's gonna run faster, and it uses standard control flow which you can easily debug it using the tools you use for any other JS code.

This post has nothing to do with functional programming, this is a poor monad tutorial.

steinuil··on Ask HN: I've Built a DHT Torrent Sniffer and Search Engine. Should I Release?
Isn't btdig also open source? I see a "fork me" button on the front page and it leads to a repo: https://github.com/btdigg-org/dhtcrawler2
steinuil··on Nietzsche in Turin
It has an atmosphere and architectural style unlike any other Italian city. It's definitely one of my favorites, though I might be biased because I'm from one of the neighboring villages (and I'm probably gonna move in the city soon).
steinuil··on Why OCaml?
> How much work would it take in term of code rewriting?

Probably a lot. Most of the operations on basic types like strings rely on C# methods rather than being implemented in the corresponding module like in OCaml (e.g. `String.split_on_char ' ' "a b c"` in OCaml vs `"a b c".Split(' ')` in F#). Type annotations on function parameters are required much more often because the compiler can't infer object types from a method call. Obviously you'll have very different libraries for doing the same things, and you'll be interacting with C# libraries a lot. Some language features like objects or binding operators exist in both languages but have very different syntax and differing semantics, and others like local opens and functors just don't exist in F#. F# also defaults to a "light" indentation-based syntax and I think the old OCaml-like syntax is either unsupported or hidden behind a compiler directive, and you'll probably want to rename identifiers from snake_case to camelCase.

> how good is the language support experience in vscode?

There's two competing LSP implementations for F#. Ionide works, but it's slow and it crashes and reports old errors for code you've just rewritten very often in my experience. fsharp-language-server seems to be a bit better in some aspects, but I haven't ever gotten it to work in VS Code.

steinuil··on Why OCaml?
Re: dependency management and build tooling: these days I'm using opam-monorepo (https://github.com/tarides/opam-monorepo, previously known as duniverse) to manage dependencies and it's working out pretty well for me. It vendors all dependencies into a node_modules-like directory inside the projects and writes an opam-compatible lockfile, and it builds all the dependencies using dune. For the most widely used packages that don't already use dune it uses an overlay containing dune ports at https://github.com/dune-universe/opam-overlays.
steinuil··on Only Persistent LogIn
I was locked out of my 10+ year old google account for daring to use IMAP to access gmail from unknown networks and ignoring the "is this you?" emails for a while. I'd all but given up on it until I got a brand new Pixel a couple years back, I figured I'd try logging in with the last password I remembered working and it just worked, no complaints from the RFA. I guess the RFA requirements are completely dropped when logging in from a new phone to avoid people getting locked out as they're setting up their phone.
steinuil··on You Don't Need Microservices
This reminds me a lot of Conway's law:

> Any organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization's communication structure.

If we apply this law backwards, microservices reflect an organizational structure with many teams working on different things so they'd make more sense in that context rather than within a small team.

steinuil··on An architecture for mostly functional languages (1986) [pdf]
> Out-of-order execution and pipelining date back to the 1960s.

On that note: I read The Soul of a New Machine a while ago, which is about a team of engineers designing a computer with a new architecture at the end of the 70s, and while it didn't go into the specifics of how the CPU was implemented it mentioned features such as different layers of cache between the CPU and the RAM, out-of-order execution, instruction prefetching and branch prediction. You'd be surprised at how many things in computers have already been around since the 60s.

steinuil··on Against Food
If the goal of this post was to generate more traffic to the author's substack it absolutely succeeded. I stopped short of writing a multi-paragraph comment about how devoid of any meaningful content this post is. The argument is that food is bad because monkeys also eat food and you don't like american snacks? Try cooking some food with decent ingredients sometime and eat some carrots as a snack instead of a twinkie. Thanks for wasting 10 minutes I could've used to have an afternoon snack.
steinuil··on It's normal to play the same song over and over again (2016)
For me the enjoyment fades only if the song itself is not very good to begin with; I start to notice the flaws and after a while I start to hate it and wonder why I even liked it in the first place. Good songs tend to pass the test of being listened to on repeat for me.
steinuil··on Logitech MX Products are incompatible with AirPods
I suspect I have a similar problem with my WH-1000XM4, the wifi hotspot on my Pixel 4a. Whenever I was listening to music from my phone connected while also using it as a hotspot for the laptop I would start losing tons of packets and couldn't reliably connect to a work VPN, and turning the headphones off would fix those issues. I'm not sure if it was interference or if they share the same antenna on the phone or something like that though.
steinuil··on Changing the primary display using the Win32 API
I wrote an F# tool specifically for changing the primary display not too long ago. This is the code that calls the Win32 API to query the displays and set the primary one.

https://github.com/steinuil/SatouinDp/blob/master/DisplayDev...

One thing I never figured out was how to map the displays you get from EnumDisplayDevices to the names you see in the display settings, or how to list them in a consistent order.

steinuil··on Eye contact between musicians
I've sung in amatorial vocal ensembles and medium sized choirs and there are several professional musicians in my friends and family.

Eye contact is very important in small ensembles especially when there isn't a director to synchronize breathing and cues with other voices or instruments who share your part, though in a lot of cases you can go by ear just listening to the other parts.

In this setting, when there is a director their basic role in a performance is to keep the tempo regular and direct rallentando and accelerando, and to remind you of cues, dynamics, and other things they might've discussed during rehearsals. During rehearsals their role is also to set the mood of a piece of music and get everybody to match it, because obviously if all the musicians have a different idea of how it should sound and feel it's not gonna be a very good performance, and in a concert they can reinforce that mood through body language.

In larger choir or orchestra's the director's role to keep the tempo becomes extremely important because you just can't rely on what you hear from the section that's sitting on the other side of the church or of the concert hall; by the time the sound gets to your ears there'll be a few ms of delay and you'll already be primed for starting late, so you have to maintain eye contact or have a "leader" in your section who will do it and to whom you'll refer for cues.

steinuil··on LGTM – A simple pull request approval system
I thought it meant "Let's Get This Merge" like it was a play on "let's get this bread". I know it stands for "Looks Good To Me" now but I still prefer my reading :)
steinuil··on Are you a baby? A litmus test
I'm depressive and have social anxiety and I still found that forcing myself to attend these social situations instead of bailing and staying home for "self-care" almost always improved my mood and made me feel happy that I went at the end. If you have a more serious medical condition that makes you physically unable to go anywhere that's another matter, but I'm guessing lots of people (just as I did) use less serious mood disorders as excuses to, as the OP put it, be a baby.
steinuil··on Fuchsia Workstation
True, but then again Italian has regular pronunciation rules and "x" is always pronounced the same way as "cs", so even if "fuxia" is not a proper spelling it's a homophone and I wouldn't be surprised to see somebody make that spelling mistake.
steinuil··on Hooks Considered Harmful
The main problem is that the hooks provided by React by default are low-level primitives of an incremental computing DSL, and you need to have a very good understanding of both JavaScript and the semantics of this DSL to work with those primitives correctly; it feels like having to reimplement strcat every time-- with every pitfall that you might fall into while reimplementing strcat in C.

Maybe this could be solved by a hooks "standard library" that provides generally useful hooks like useTimeout and a useMemo that is actually stable as mentioned in @purplerabbit's comment.

steinuil··on Why learn Racket? A student's perspective
I love racket/gui and recently shipped a product using it for a diagnostics tool! The killer features are as you said that it uses native widgets, but also that it doesn't require any sort of dynamic linking to heavyweight C libraries (other than the ones Racket itself comes with) and that you can easily compile it in a redistributable form with basically no dependencies for all platforms. I can't recommend it enough.
steinuil··on What Color Is Your Monad
I was trying to write a comment making the same point but honestly, I'm not familiar enough with effects to know what exactly you can do with them. Good to know that I wasn't far off!

I'm curious about one thing though: unless you're passing a parameter that introduces an additional effect F into the function, what's the point of making it generic over the effect set? In a language with typed effects, all effects that could be performed by a function would already be known, so letting a unit function `fn get_user<F>() ->{F} T` where i.e. `F: DiagnosticData -> ()` decide which instance of an effect that takes a DiagnosticData and yields unit, as opposed to `fn get_user<F>(g: () ->{F} ()) ->{F} User` where the effect is clearly introduced by `g`, seems a bit overkill to me.

steinuil··on What Color Is Your Monad
You can only dereference raw pointers from within an unsafe block so they're only useful inside unsafe blocks. IMO Unsafe Rust != Rust, unsafe is an extension to the language that is clearly separated from safe code, and using it essentially means voiding Rust's safety contract.
steinuil··on Ask HN: Is the past disappearing on the web?
I think Google prioritizes newer content because AFAIK modifying the date of a page to make it look like it's been published more recently is a common SEO trick.
steinuil··on Evaluating front end frameworks and not choosing any
> Our choice does not need anyone to learn anything, and one can create a widget in no time!

EJS is not "anything", imo. I'd probably feel at home with it since I've used a bit of ERB, but despite how simple it looks there's some gotchas, syntax highlighting is always going to be an issue, and making those widgets modular is going to require at least some conventions to be used, and at worst some helpers that will eventually start looking like a framework (of course this depends on the scope of the project). Also, bundle size for EJS is not mentioned.

steinuil··on Job Applicant Resumes Are Effectively Impossible to De-Gender
> A lot of machine learning sounds like the computers are just cargo-culting.

That's precisely what ML is. Though to be fair, interviewing done by real humans is also largely based on cargo culting.

steinuil··on Widdler is a single binary that serves up TiddlyWikis
I have a similar project but it just serves a single wiki via http and doesn't support WebDAV or authentication, and it's in Rust rather than Go. https://github.com/steinuil/twkwk
steinuil··on Advent of Code 2021
I should probably finish last year's. I did all parts mostly in time except for day 20, I couldn't figure out part 2 and just refused to do it.
steinuil··on Types of Parser Combinators
Author here, kind of. Most parser combinators only deal with strings and streams of bytes, but they can also be used for transforming other kinds of data. I think they're pretty useful for working with stuff like JSON or XML and I'd like to see more parser combinator libraries with support for these kinds of data structures. What I tried to do in the post is give names to the different kinds of basic blocks that are needed for parsing all these different kinds of data.

I'm more or less using Alexis King's definition of "parsing" here, as described in this post: https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-va...

steinuil··on In C, how do you know if the dynamic allocation succeeded?
Is the title a reference to Terry Riley's In C?
← PreviousPage 3 of 8Next →