HNHacker News
TopNewBestAskShowJobs

samhh

167 karma · joined April 9, 2019

submissionscomments
samhh··on TypeScript vs. PureScript vs. ReasonML vs. Elm
I think it's unfair to categorise TypeScript as the easiest for interop if you've asserted that static type safety is important to you. If the typings aren't already available you'll need to create a type declaration for them - meaning it's a lot closer to PureScript and ReasonML than it might otherwise appear - and I say "need" because otherwise you'll have `any` flowing through your codebase which defeats the purpose.

Your conclusion is reasonable given your desire to gradually migrate a preexisting codebase, but I'd personally come to a very different answer were this for a greenfield project. TypeScript is wonderful and I use it at work every day, but its limitations are frustrating and it's fundamentally unsafe.

samhh··on Ask HN: What projects are you working on now?
I have a side project called Bukubrow. It's a WebExtension that plugs into Buku, a CLI bookmark manager.

I'm currently rewriting it in PureScript. It's hard to get pure functional programming's foot in the door at work - understandably, the business case against it is reasonable given our employee demographics (i.e. mostly Java devs) - so this is the next best way to learn.

--

Bukubrow: https://github.com/SamHH/bukubrow-webext

Bukubrow PureScript dev branch: https://github.com/SamHH/bukubrow-webext/tree/purescript

Buku: https://github.com/jarun/buku

samhh··on RFC: Adopt a modern JavaScript framework for use with MediaWiki
It's not very strongly typed at all, and it absolutely doesn't force you into the OOP paradigm.

Why don't I consider it strongly typed?: Structurally subtyped as opposed to nominal typing, the pervasiveness of any, allowance for vanilla JS coercion, exceptions and promise rejections are untyped, etc.

samhh··on Problems with TypeScript
If the strings are static you can define a type that's a union of string literals, create a tuple containing them all, and then a type guard function that simply checks the argument against the array. If the strings are dynamic then you're better off looking at a library like newtype-ts, but it's not very ergonomic compared to the likes of Haskell/PureScript so use sparingly.
samhh··on I am a horse in the land of booleans
There is both null and undefined in JavaScript. Additionally, an empty array coerces to true because it's an object and objects are always truthy.

Personally I'd prefer that not even null/undefined coerced to false, or could otherwise be used in a boolean comparison, as for me they still signify different meanings and even in type-safe languages can lead to subtle bugs. I really dislike coercion having principally worked with JavaScript/TypeScript.

samhh··on Toilets of the World
Mainland Europe. Come on, it was obvious what I meant.
samhh··on Toilets of the World
I agree, and I grew up in a country where they're very rare (UK) and still don't have one.

I love holidaying in Europe. Bidets, bidets everywhere.

samhh··on Ask HN: What people skills do you wish you learned earlier in your career?
I began working from home and essentially opted out of it.

I feel more and more like Larry David in Curb every day.

samhh··on At what time of day do famous programmers work?
I dislike the apparent inability to label groups of changes with `git stash`, so instead before leaving a branch with in-progress changes I'll commit them all as "WIP". Then, when I return to the branch, I'll check if the previous commit was WIP (`git log -1`), and if so will reset it (`git reset HEAD~1`). It's the best workflow I've discovered for dealing with this problem, and it means that I don't lose my commit history which is otherwise very clean.
samhh··on Vue RFC: Expose logic-related component options via function-based APIs instead
This new API is additive and not a breaking change, much like React's addition of hooks.
samhh··on Vue RFC: Expose logic-related component options via function-based APIs instead
> with no real gain

Did you read the linked motivations?

samhh··on Considering Removing TypeScript
"[TypeScript] seems to encourage complex types instead of simpler contracts."

Having refactored a few different codebases across two different businesses and my own personal projects, I must say subjectively that this is the opposite of what I've experienced. Without TypeScript there is essentially no contract at all beyond sparse documentation (be realistic) and the fading memory of whomever implemented the interface you're looking at.

samhh··on Elegant Error Handling with the JavaScript “Either” Monad
You should never have unexpected exceptions if you embrace static typing and one of the many libraries that take this idea and do it better, for example `purify-ts`. It also comes with methods included for statements that might throw such as `JSON.parse`.
samhh··on Pi-hole: A black hole for Internet advertisements
Yes, there are both manual whitelists and blacklists. There are also easily accessible options for disabling the adblocker permanently or temporarily, in the latter case on a timer of your choosing e.g. for 5 minutes.
samhh··on We Don't Have a Talent Shortage. We Have a Sucker Shortage
I was put in touch with a business by a recruiter. I stated my salary expectations, received the typical "that's a little high..." from the recruiter; as per usual, the offers I received justified my stance.

They offered me 15% below what I wanted alongside a very uninspiring business in advertising. I was honest and said I was interviewing elsewhere and wasn't about to accept that offer quickly, though it wasn't off the table. They waited one week and pulled the offer. I accepted a better offer pretty much the next day.

The recruiter got back in touch with me a week or two later and said quite frankly that they regretted their decision as they've struggled to find anyone comparable in my salary range. Because, as it finally dawned on them, my salary expectations weren't even that high - I intentionally put them in the mid-range for my skill-set because I care deeply about work/life balance and I'm picky about tech stack.

Unrelated, but I also had a similar experience last year when buying my first home. First place we put an offer in with was poorly advised by their agent, and they came back begging a few months later by which point it was too late. It's only two anecdotal data points but it does seem to be that people are willing to lose a lot in order to gain a pittance.

samhh··on Netlify Dev
I chose to rewrite my portfolio site in Gatsby and deploy it to Netlify with my custom domain pointed to it. It's a big improvement in ease of use versus how I used to do it with a Node server hosted on DigitalOcean, as good as I found their service to be. Do those other services allow you to hook up a custom domain?
← PreviousPage 4 of 4