HNHacker News
TopNewBestAskShowJobs

shirogane86x

106 karma · joined March 30, 2020

submissionscomments
shirogane86x··on Kysely: TypeScript SQL Query Builder
On a similar note, there's also sqlx for rust [1] - and I find it extra impressive that they manage to support not only postgres, but sqlite and and mysql too.

[1] https://github.com/launchbadge/sqlx

shirogane86x··on Avoid exception throwing in performance-sensitive code
if you only limit yourself to the standard library, you would need to unwrap and rewrap the error - although admittedly since Result<T, E> is a type like any other, you could add an extension function (through a trait) so that you can add context more easily. If you use use one of the error handling libraries though, you're in luck - adding context is usually a single function call away:

    //without context
    some_function()?;
    //with context, using anyhow
    some_function().context("function returned error")?;
    //with wrap_err, using eyre
    some_function().wrap_err("function returned error eyre")?;
shirogane86x··on Lichess gets a big upgrade. It doesn't go as planned
As far as I know, the only available approaches are brands and just wrapping it in a one element object (but that's even worse). But the branding is a lot easier if you just use something like zod [1] for all your types.

[1] https://github.com/colinhacks/zod#brand

shirogane86x··on Nintendo apologizes for Pokémon performance problems, promises “improvements”
Admittedly you can still transfer pokemon around, just not as freely (and not yet, for scarlet&violet). Pokemon home lets you send pokemon from far back, and I know people who keep pokemon on there that they transferred forwards from the GBA days. It's not 100% of them (although, at least for competitive, that's somewhat of a good thing). Sadly, pokemon home support is expected to come spring next year for scarlet and violet. And competitively speaking, this generation is looking really interesting, especially compared to the disaster of the last one, so I don't think all's lost yet.

once (if?) the technical issues are fixed, this chapter is probably gonna be the best pokemon game that we've had for quite a few generations, imho.

shirogane86x··on Welcome to C# 11
F# is still a lot more functional, has cleaner stuff for functional style coding (like the pipe and reverse pipe operator, function composition and custom operators). Computation expressions are still better than LINQ's comprehension syntax, imo. And I don't think C# is getting SRTPs or Type providers anytime soon.

Another thing to keep in mind is that all of these changes are available to F# too, and static members in interfaces (plus some extra syntax goodness around SRTPs that they are introducing) are gonna be amazing (interfaces + static members are starting to look eerily close to typeclasses, in a good way)

shirogane86x··on Programming language comparison by reimplementing the same transit data app
as someone who did (and still does) a lot of Haskell, and actually loves it, seeing http4s reminded me less of Yesod and more of Servant: really high flexibility, advanced type level magic, and a fairly steep learning curve - especially so if you're not accustomed to advanced typed functional programming.
shirogane86x··on Introducing Svelte, and Comparing Svelte with React and Vue (2021)
Thank you very much for the explanation! I agree with you that this information should be somewhere, especially seeing as I (mistakenly) thought that too, I probably would've had less of a knee-jerk reaction to it if I knew that it's effectively syntax sugar. I'm guessing I'm not the only one who has really bad memories of angular... Sorry for the misunderstanding!
shirogane86x··on Introducing Svelte, and Comparing Svelte with React and Vue (2021)
I'm still very skeptical of the random templating syntax, of the weird reactivity with gotchas and most of all, of two way databinding. Wasn't two way databinding one of the reasons we got react (and one of the reasons i bought into it) back when angular was the go-to? I feel like every time i try to use two-way-databinding it ends up in a jumbled unintelligible mess where I'm chasing mutations around... Personally, if I have to try out a new framework, I'll probably try out solid instead.
shirogane86x··on Cognitive loads in programming
I started out at the very beginning doing full stack JS, but at some point I started using Haskell for my personal projects, and my first job was in F#, so I think the combination of those two may just have impacted the way I think about programming a lot
shirogane86x··on Cognitive loads in programming
I have the same thing, but in the opposite direction: I can read recursion, map/filter/reduce/any kind of higher order function (even the wonky haskell ones, like traverse) just fine.

But the moment I start seeing mutation, or for loops complex than a for each over a data structure (like nested ones, or while, or weird indexing) my brain completely shuts down. In my first professional job (F# developer) I had to look up how to write classes every time we created one (not often, to be fair).

I think it's all a matter of habit and familiarity, although I'll admit that finding places that program functionally (where I'm most proficient) is really hard

shirogane86x··on Avoiding space leaks at all costs
I am gonna be completely honest, I have never quite been able to understand expression templates properly. is it possible to use them to get hassle-free laziness? is there any example of a library that does this (just to look at it and see how it's done)?
shirogane86x··on Avoiding space leaks at all costs
Sadly even though what you say is true, I do not know of any languages that get that right. Even those that do care enough to give you a way to make lazy values, they require you to explicitly wrap them and force them all over the place, making lazy programming effectively so noisy it's unusable. Which is the main reason why I still find myself coming back to haskell (stuff like parser combinators is just so unwieldy without laziness and do notation...)
shirogane86x··on Show HN: Devbox – Easy, predictable shells and containers
I'm assuming for windows it only works in WSL2? cause last time I checked nix wasn't compatible with native windows development, sadly
shirogane86x··on Ask HN: Europeans, what keyboard layout do you use for programming?
Keyboard is standard Italian layout but i actually use eurkey because it has a US layout (which i find more comfortable for symbols) + all the accented variants for European languages (using altgr and letters). Pretty optimal for me.
shirogane86x··on Monad Confusion and the Blurry Line Between Data and Computation
Haskell (at least as implemented in GHC) has TemplateHaskell, which is somewhat of an inbetween: at a distance it kinda resembles lisp macros if you squint a bit (it's of the "eval and quote" kind, so to say) but it's exclusively compile time. It's also quite unwieldy, and most of the time it ends up being unnecessary because Haskell can do things through other means. Laziness for control structures, Typeclasses with all the extensions for code generation... nowadays I only really see Template haskell used for two things: generating top level bindings that don't really belong in a type class (e.g.: singletons, lens, polysemy) or embedding of another language (yesod's hamlet, or some sql libraries). Haskell is not really built to support macros from the start, they're seen as more of a necessary evil, IMO. If you've used rust before, it's kinda like rust macros except worse :)
shirogane86x··on Part of my code makes Copilot crash
Apart from all the things at the top that have no sources and that honestly sound like propaganda:

> Back before all of this, LGBQT people were happy to just be seen as normal and like everyone else

Since when, sorry? When were we *ever* seen as normal people. Slurs flying around. People getting beat up. Suicide rates for trans youth are through the roof. Constant hate and bullying offline and online, and all of this is just for the countries that have it good. In some places, being yourself is a literal death sentence.

Just the fact that you say that LGBTQ+ people were "happy" to be seen as "normal" shows how out of touch you are with the things queer people experience on a daily basis. And not only that.. what the hell does "normal" mean. What, you expect us to conform just enough that the straights don't see us as an eyesore?

I shouldn't be angry about a random comment on the internet, but I am. And you know why? Because right now, at this point in time, there's many people in my country and others that say the exact same bullshit that you're saying, and they weaponize it to:

- deny my right to marry my partner - deny my right to adopt kids - deny my friends' right to start HRT, so that she can stop feeling gender dysphoria every single day - stop laws that would protect me from being publicly berated in public for my sexuality - push homophobic and transphobic rethoric on their children, so that LGBTQ+ teens go through hell

I'd wager that "marriage", "family", "not feeling like shit", "being respected" are pretty basic rights... aren't they?

shirogane86x··on Part of my code makes Copilot crash
This whole comment section is pretty frustrating. I don't even live in America and I'm scared. An enormous wave of hate is starting to show recently - even in the comparatively few places where queer people are relatively ok.

I still don't get to marry in my country - only civil unions, and even that was hard fought. No adoption, no real protection from hate crime. Elections are happening soon, and the projection of who's likely to win is... bleak, to say the least.

And I'm the lucky one: I'm a cis gay man, and out of the whole LGBTQ+ community, I'm in one of the least bad spots to be in. My trans brothers and sisters have it way, way worse - especially when surgery and/or hormones are not nearly as easy to come by as these people on the internet would like to think.

Me and my boyfriend are careful about any public display of affection, out of fear. I have trans and non-binary friends who have to either hide who they are, or fear stepping outside their homes - or even their own bedrooms. And one day - if lawmakers would be so kind as to let me - I would love to raise one or more children. To be a father. But as it is, even if I would... this is not the world I would want to raise a child in.

It's all fucked up.

shirogane86x··on Programming languages endorsed for server-side use at Meta
I think Sigma (FB's spam filtering system) is still written in Haskell, but I may be wrong (basing this around internet rumours since I don't work at Meta).
shirogane86x··on Build Pong in Your Terminal with Go for Some Reason
That is 100% fair. I mostly develop on .NET+TS at $dayjob so I never really have experienced particular problems with nuget, and I've had the luck of never having an npm package go down on me either - so I just never really experienced the problems that people are frustrated about.
shirogane86x··on Build Pong in Your Terminal with Go for Some Reason
I don't really buy into go (it's not my type of language), but I wanted to ask a genuine question: are there many semi-mainstream languages that don't have modules that _just work_, or an official plugin for VSCode that just works? I've never found that to be a "plus", as much as it is the bare minimum. and nowadays I don't see that many up and coming languages that miss out on it. Admittedly though the cross compilation is nice (not enough to win me over, at all, but still very nice. The very few times I've needed cross compilation in other languages I reached for nix, and that wasn't very pleasant)
shirogane86x··on Nyxt 3 Pre-release 1 (a Lisp powered web browser)
This looks really nice! I will definitely try this out when I get the chance, although as it is I can't do much other than playing around with it - I'm stuck with windows :(
shirogane86x··on Teams is killing my Mac every day
> Discord is absolutely terrible though compared to what I'm used to What are you used to? Genuine question. I've tried many options and to be honest, discord has been the nicest so far. Yeah, it's far from perfect - but I still found it way better than slack, teams, meet, zoom. Although I personally don't really mind the mentions - I spend a decent amount of time in public servers, and have learnt to just suppress what I don't want (I also run windows, not macOS, so maybe that's also part of the "issue"?)
shirogane86x··on Tell HN: We are trying to get tail calls into the WebAssembly standard
That sounds super nice! Maybe this will turn out to be a nice way of compiling languages which make heavy use of tail calls to the browser (I'm thinking Haskell, Purescript, Erlang, Ocaml). For purescript specifically this means no MonadRec needed which is quite exciting! (if and when a wasm backend is made, ofc)
shirogane86x··on Monads are a class of hard drugs
Yeah I was about to write this. Thinking that monads are only about sequencing works only for IO, effectively. Option and Either are about short circuiting, and there's others that mess in execution state in hilarious ways (like the TARDIS monad and its time travelling shenanigans). I tried "understanding" monads for years but now I'm not really sure if there is anything to understand in particular. It's super simple and super generalized at the same time, it's really hard to explain why it is that way without going deep into scary mathy territory (while also preserving analogies that actually apply)
shirogane86x··on Today I Deleted Notion
I've actually been using notion more and more. I tried obsidian at first but really didn't feel like syncing the stuff by myself, and as I only exclusively take notes on my PC and never pen and paper (because of dysgraphia) I found that it got out of my way and had enough features for me to use it as a daily driver.
shirogane86x··on Tao: A statically-typed functional language
This looks great! I've actually been experimenting with making a functional language too, in rust - so I'm probably gonna read through the code soon! Also, those error messages look really good - I'm totally gonna try ariadne and chumsky out :)
shirogane86x··on The new wave of React state management
I actually made pretty extensive use of the redux time travelling debugger at my last job, I found it to be very convenient, especially as the application got bigger and more convoluted - not really because of development issues, but just general feature creep (features were being sold left and right by a less than stellar marketing team)
shirogane86x··on The new wave of React state management
As someone who didn't get react at all before hooks, and still doesn't 100% get react with class components (but is quite proficient with hooks) what's the issue with hooks specifically? genuinely curious. I find react with class components very messy, and especially in the basic components, I find useState + useEffect a lot cleaner and easy to reason about than setState and all the lifecycle hooks...
shirogane86x··on Type-checked keypaths in Rust
scala has HKTs and should be able to implement lenses just fine, I think. TS and OCaml can emulate HKTs in a really awkward way, but they can also just implement a less general more restricted subset.
shirogane86x··on OCaml 5.0 Alpha Release
I personally haven't had much chance to use docker with Haskell specifically, but I imagine that it would definitely work, it would just take a bit more work to get going, so I just take the option that is less friction (at least for my specific usecases). Nix is also somewhat popular in the haskell community - especially when it comes to GHCJS (with tools like obelisk making it easier to develop cross-platform apps using web tech). So I just go along with the flow of the community, personally, especially considering that I use Haskell exclusively for my own personal stuff (sadly).
← PreviousPage 2 of 4Next →