• 0 Posts
  • 501 Comments
Joined 2 years ago
cake
Cake day: July 3rd, 2023

help-circle
  • expr@programming.devtoProgrammer Humor@programming.devstop
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    15 hours ago

    I’m not sure what you mean by “locality of reference”. I assume you mean something other than the traditional meaning regarding how processors access memory?

    Anyway, it’s often been said (half-jokingly) that Haskell is a nicer imperative language than imperative languages. Haskell gives you control over what executing an “imperative” program actually means in a way that imperative languages don’t.

    To give a concrete example: we have a custom monad type at work that I’m simply going to call Transaction (it has a different name in reality). What it does is allow you to execute database calls inside of the same transaction (and can be arbitrarily composed with other code blocks of type Transaction while still being guaranteed to be inside of the same transaction), and any other side effects you write inside the Transaction code block are actually collected and deferred until after the transaction successfully commits, and are otherwise discarded. Very useful, and not something that’s very easy to implement in imperative languages. In Haskell, it’s maybe a dozen lines of code and a few small helper functions.

    It also has a type system that is far, far more powerful than what mainstream imperative programming languages are capable of. For example, our API specifications are described entirely using types (using the servant library), which allows us to do things like statically generate API docs, type-check our API implementation against the specification (so our API handlers are statically guaranteed to return the response types they say they do), automatically generate type-safe API clients, and more.

    We have about half a million lines of Haskell in production serving as a web API backend powering our entire platform, including a mobile app, web app, and integrations with many third parties. It’s served us very well.


  • As a senior engineer writing Haskell professionally, this just isn’t really true. We just push side effects to the boundaries of the system and do as much logic and computation in pure functions.

    It’s basically just about minimizing external touch points and making your code easier to test and reason about. Which, incidentally, is also good design in non-FP languages. FP programmers are just generally more principled about it.



  • Because they are universally incapable of coming anywhere close to the full power of git.

    I can’t tell you how many times I’ve had GUI-only people ask me to unfuck their repo (fortunately not at my current job, because everyone uses the CLI and actually knows what they’re doing). It’s an impedance to actually learning the tool.

    Ultimately any GUI is a poor, leaky abstraction over git that restricts many of the things you can do for little actual benefit.



  • The point of the joke is not that the Python interpreter will change types mid-program on its own, but that you don’t have any real way of knowing if you’re going to get the type you expect.

    Programs are messy and complicated, and data might flow through many different systems before finally being used for output. It can and often does happen that one of those systems does not behave as expected, and you get bugs where one type is expected but another is used in actuality.

    Yes, most likely what would happen in Python is a TypeError, not actual output, but it was pretty clearly minor hyperbole for the sake of the joke.





  • expr@programming.devtoComic Strips@lemmy.worldTalent [Three Panel Soul]
    link
    fedilink
    arrow-up
    1
    arrow-down
    1
    ·
    edit-2
    17 days ago

    Kids are just really good at learning quickly. That’s all it is, really. Chess is all about study and learning, so kids are very adept at getting good quickly. Obviously there are some who are prodigies, but that’s pretty exceptionally rare.

    Adult learners also can get good quickly, but it requires a lot of meta-cognitive thinking (thinking about how you think, or “learning to learn”), time, and discipline. The guy that runs my local chess club is probably in his 60s, and he told me that he was sitting around ~1100 for a long time until recently he started studying, where he rapidly jumped up to ~1600 after, as he put it, “things clicked”.

    It’s never too late to rapidly improve your own abilities, which is what I really love about the game, because I find it teaches you to apply that mindset to all aspects of life.









    1. Supposedly there’s a way to install nix without root access, but I can’t speak to it as I’ve never tried. Ofc it doesn’t require sudo to install packages or anything, though.
    2. I don’t think it does this right now, largely because it’s super fucking complicated (as is basically everything Apple) and homebrew casks themselves have had a ton of headaches around it. But nevertheless, I think home-manager has some workarounds it uses itself to enable many common GUI apps on MacOS.
    3. Not sure exactly what you mean, but I think it does that?

    If you want to install packages purely by name, you can use nix-env -i hello or whatever. But it’s pretty janky and not really a recommended way of doing things.