167 karma · joined April 9, 2019
Depending upon what the likes of `Aff` compile down to, you may not even need a JS wrapper. If the compiled type signature is compatible you can just point the Node.js runtime directly to the PureScript output.
Have something nullable? Stick it inside `Maybe` and map it.
Have a side effect in `IO` and want to manipulate the result? Map it.
Following that, look at monadic binding. It's basically flat mapping.
From here you can start to see how programs can be composed in languages like Haskell. You have these foundational typeclasses and you sort of just connect all your functions together with them until you're left with one big expression in `main` which is your application entrypoint.
Same goes I think for `git restore` over `git reset`.
Beyond that there's functions that throw/reject doing so outside the type system, something solved by Either/Option/similar types in fp-ts.
The biggest benefit of fp-ts though is that it makes you think functionally. If you're dead set against that, then there are plenty of other libraries that give you types/wrappers like these without having to use pipe/flow (two functions you'll want to use before anything else in fp-ts).
As an aside, TypeScript is very unsafe by default, and still relatively unsafe with strict mode enabled. Stringent fp-ts usage bypasses these issues.
Yeah, I've found myself never really needing that functionality. I use bookmarks principally as time savers and secondarily as ephemeral reminders; I think the habit people have of stacking up bookmarks they'll never come back to, likewise having hundreds of tabs open, is an antipattern.
In rare cases where I've wanted to keep a link for documentative purposes, it's always been more appropriate to keep it alongside that source material, which is typically a markdown file.
All that said, it'd be quite easy to implement tags and descriptions provided you'd be willing to write them yourself (and given how messy some websites' metadata is, I would). You could just grep for what you want.
The idea came to me yesterday as I wanted to use a bang for ProtonDB. I didn't fancy waiting around for it to be added to DDG following submission, and that led me to ponder the other harms of this really useful feature being locked behind DDG's service.
In theory, with the script being so simple and working on the basis of mere input and output, it should be easy to write other tooling around it, which I've briefly touched upon in the README.
The shell script is extremely simple, but anyone with experience in writing them might be able to spot problems with it, please do let me know if you do.
I'm unsure about how best to package banglists. One option would be to provide a config file with a list of lists, a bit like you do with some adblocking software, but that'd presumably require some sort of intransience.
Anyway, feedback welcome!
fold(constant('my static fallback'), f)(x)
What sucks about this, as much as it's my preferred pattern, is that without native pattern matching in the language it's unclear which callbacks are for which type constructors. It's not so bad for something like Either, but if you're using something like DatumEither with ~five constructors it's a bit of a mess.PureScript I really like but it's a massive jump from JS/TS to PS/HS.
All of these languages are harder to abandon than a library in the same language you'll keep using if you decide against the paradigm down the road. Do I like this compromise? Not really, but it makes sense.
Also, advertising use of a functional language might open you up to candidates who wouldn't otherwise apply.
Secondly, I think there's something to be said for familiarity. I think looping is second nature to most of us not because it's superior or more intuitive, but because traditionally this is one of the first things we're all taught. If functional programming were the norm and people were taught recursion early on instead I think your notion of simplicity would differ.
I've been teaching a little bit of programming to a beginner lately, and they've often found functional approaches to problems easier to grasp than their imperative equivalents because they're more mathematical. It's like an expression of something they already know versus looping, mutability, et al which are new concepts entirely.