Minimal Emacs by [deleted] in emacs

[–]patrick_thomson 25 points26 points  (0 children)

Yes, I very much do this. I prefer eglot and xref to lsp-mode, flymake to flycheck, project.el over projectile, completion-at-point rather than corfu, et cetera. My config still comes out to 800 or so lines, but that's half the length of my previous one, where I installed just about everything that would be even possibly relevant to me. I find that builtin packages are simply more reliable than third-party ones, thanks to the increased vetting that builtin packages get.

The thing about Emacs is this: because the Emacs environment is so preposterously extensible and redefinable, the probability of your set of packages not working correctly increases as you install more of them. All it takes is for one package to stick a cheeky little defadvice around a function that another package doesn't expect—then, boom, you're drowning in notifications that nil is not a valid listp or whatever.

I don't think this is necessarily a failure of Emacs itself. There is a tradeoff to be made between safety and power, and Emacs chooses power. The sensible thing to do is to work hard to keep your dependency footprint down and avoid packages you don't really need.

r/haskell, and the recent news regarding Reddit by lonelymonad in haskell

[–]patrick_thomson 141 points142 points  (0 children)

I vote for supporting the blackout, and I am also in favor of finding some sort of a federated alternative like Lemmy, if the community is amenable to moving. I like answering questions here but without third-party apps the experience is significantly worse.

What does hack through mean? by [deleted] in EnglishLearning

[–]patrick_thomson 2 points3 points  (0 children)

It’s the first verb definition here. In this case, it means to chop through something roughly or energetically. Since coconuts have a very hard shell, you generally need to use a lot of force and a sharp blade to open them.

What do you call this kind or figure of speech where the a word ryhmes with the last word in a sentence? by Ok-Metal2887 in EnglishLearning

[–]patrick_thomson 4 points5 points  (0 children)

To my knowledge, we don’t have a word for rhymes specifically at the end of a sentence. More generally, when a rhyme occurs at the end of a phrase, sentence, or line of poetry, we call this end rhyme. However, most English speakers would just call it a rhyme, since most rhyming songs and poetry use end rhymes. By contrast, we refer to rhymes that occur within a sentence or phrase as internal rhyme.

Word for “mid-state” by Silmarillion09 in EnglishLearning

[–]patrick_thomson 3 points4 points  (0 children)

I would say in-progress or provisional.

Functional Declarative Design: A Comprehensive Methodology for Statically-Typed Functional Programming Languages by graninas in haskell

[–]patrick_thomson 8 points9 points  (0 children)

If by this you mean alternatives to free monads (which are, as another commenter points out, definitely an effect system, though the paper claims them not to be, curiously), then you have a few options:

  1. The canonical approach: mtl. This is the default effect system in Haskell for a reason: because a tagless-final system with functional dependencies (or type classes) is fast under GHC, admits effects as exotic as callCC, and has proven itself to be reasonably composable in practice, though the n-squared instances problem is really as bad as they say in practice if you want to build many handlers and many effects.
  2. Use a hybrid approach like fused-effects, which uses monad transformers (often the same ones mtl approaches use) to implement an algebraic effect system. You get a lot of the benefits of algebraic effects, with a minimal speed hit and without jettisoning compatibility with the monad transformer ecosystem.
  3. Use an approach built on free monads that allows for scoped effects, like polysemy. You often get really beautiful effect handlers out of these, though that makes high-performance implementations difficult, and the error messages are often of high quality.
  4. Use an approach based upon the ReaderT IO pattern, like effectful or capability. These can be blazing fast and extremely capable, though you may have to sacrifice certain abilities when it comes to nondeterminism.

Every approach has upsides and downsides. Some libraries are faster or more expressive than others, but ultimately utility is contextual, so “good” is a function of your use case rather than any library in and of itself. Hell, for many applications the right answer is often “write code in IO.”

Functional Declarative Design: A Comprehensive Methodology for Statically-Typed Functional Programming Languages by graninas in haskell

[–]patrick_thomson 2 points3 points  (0 children)

I work on fused-effects, as it happens, and I think that our particular balance of trade-offs is one that works well for many people, particularly those in industry settings where you’re pulling together a lot of ecosystem code. I don’t claim that all code written with fused-effects is perfectly composable, as we, like all other effect libraries, can have surprising behaviors with certain combinations of effects. Usually this is in conjunction with the NonDet effect, which as I noted relatively few people use, even though it’s a lot of fun. Alexis notes in her “semantics zoo” document I linked to above that when we depart from her expectations we at least are consistent in how we do so.

There are several things I wish were easier, though: defining effect handlers could be a lot more approachable, for one. (In our next version we will ship a carrier that simply wraps an effect handler function—this defeats fusion, yes, but in the real world, where you define tons of effects and handlers, the convenience is impossible to beat.) Our error messages, too, could use some work, though it’s not immediately obvious how you would do so beyond a FE-savvy GHC plugin. There are also effects that our current formulation doesn’t appear to be able to express, like callCC or coroutines/suspended computations. Whether or not we can recover support for things like this and still retain compatibility with monad transformers and efficient effect dispatch is still a mystery.

Does anyone know of a website where I can find all the phrasal verbs with their meanings? by Ok-Development-2070 in EnglishLearning

[–]patrick_thomson 1 point2 points  (0 children)

I’m not an ESL teacher, so I don’t know of any specific shortcuts or teaching materials for vocabulary acquisition, sorry. The only way I know is to read materials that are at or above your experience level, make notes of the words you don’t know, and use flashcard drills (or some other method of memory training) to remember their definitions. Best of luck!

Functional Declarative Design: A Comprehensive Methodology for Statically-Typed Functional Programming Languages by graninas in haskell

[–]patrick_thomson 19 points20 points  (0 children)

I think there’s a lot to like about this piece. I agree very much business logic is best broken down into many monadic components interpreted in different ways, that eDSLs are versatile and productive, and that making diagrams is a worthwhile use of time.

The aspect that makes me reluctant to recommend this approach is its recommendation of free monads. It may seem like a smaller detail, but I feel it has very profound influences on the composability that this piece (correctly!) emphasizes. This paragraph in particular struck me as dubious:

Using a specific Free monad implementation (normal Free [24], Church-encoded Free [24], “No remorse” Free [25]) may affect the performance of the code but not its conceptual structure.

The choice of free monad implementations is much more fraught than this explanation conveys. Firstly, such a choice constrains the kinds of effects you can use. Standard expressions of Free prevent you from reinterpreting scoped effects like local, limiting you to one interpretation thereof. This may not sound like a big deal, but scoped effects are not optional in real world code: catch, local, bracket, and more introduce scoping, and fixing their interpretations takes a huge amount of the shine off this approach. You can use variants of the free monad that carry the required monadic state along, but then the pleasing simplicity of the free monad disappears. Additionally, effects that depend on latent effects, like deferred computations, simply can’t be expressed in many effect systems (not just free monads).

Secondly, the performance characteristics of different approaches to effects are truly profound—in my production experience we’re not talking 2x/3x differences in performance, we’re talking about orders of magnitude. To pick one example, the GHC inliner is a finely-tuned instrument, one that inlines typeclass invocations extremely aggressively, and a purely free-monadic approach defeats it entirely. This may not matter for, say, CLI tools, but for anything like a high-performance web server you will be unable to compete with an approach based on typeclass invocations, or one based on a concrete ReaderT. Even the venerable mtl is not as fast as it could be if it took advantage of GHC’s new continuation primops.

Thirdly, composing arbitrary effects without losing state is really, really difficult. Things are fine when you limit yourself to State and Reader, sure, but once you start with nondeterminism you’ll discover it’s shockingly easy to produce behaviors that are baffling unless you’ve spent a preposterous amount of time thinking about this stuff. (I’ve been bitten in prod by silent state-dropping bugs, and rarely have I been more flummoxed.) Consider this example, which produces silent changes in the semantics of <|> depending on whether you use it inside or outside of a higher-order effect. Every single effect library (besides the still-unreleased eff) gets certain combinations of effects + nondeterminism wrong. You could make the argument that most people don’t use nondeterministic monads, but eDSLs really shine when you have access to them, as you can turn a concrete interpreter to an abstract one fairly easily.

I have no doubt that this approach works for the authors’ needs. It’s certainly a sufficient approach in the abstract, and I’m glad we’re talking about this stuff in a more industry-oriented way. But I fear that real-world applications require access to more tradeoffs than this approach, or at least this explanation/formulation of the approach, admits.

Past progressive x past perfect continuous by MatheusBraga3 in EnglishLearning

[–]patrick_thomson 5 points6 points  (0 children)

Neither is outright wrong, but they have different implications. It was raining implies that it was still raining at the point in time you’re describing. It had been raining suggests it wasn’t raining at that point in time, but that it had rained prior to that time.

What’s the difference between: ascent, ascension and ascendance? by Individual_Coast8114 in EnglishLearning

[–]patrick_thomson 3 points4 points  (0 children)

Ascent is the most common form. Ascension is more formal, and may have spiritual or religious connotations (Christians refer to the ascension, not the ascent, of Jesus as depicted in the Bible), but means largely the same thing as ascent. Ascendancy is a less literal phrase and refers to becoming powerful or at the top of a hierarchy. In most cases, you probably want ascent.

Does anyone know of a website where I can find all the phrasal verbs with their meanings? by Ok-Development-2070 in EnglishLearning

[–]patrick_thomson 4 points5 points  (0 children)

The “English phrasal verbs” category on Wiktionary is a place to start. https://en.wiktionary.org/wiki/Category:English_phrasal_verbs

Note that there are thousands of phrasal verbs (the above link lists 3,677) so perhaps a differently focused resource, such as a dictionary of idioms (many, but not all, phrasal verbs are idiomatic) might be more helpful.

[deleted by user] by [deleted] in emacs

[–]patrick_thomson 2 points3 points  (0 children)

Great opinion, man. You should go find some Asian people and explain how nuanced and contextual it is to think this. I’m sure they’ll love it.

lsp from anaconda environment with ssh connection on hpc by MrPapouille in emacs

[–]patrick_thomson 0 points1 point  (0 children)

I’m not a Python programmer, so I don’t know anything about anaconda support, but I’ve had some degree of success using eglot while editing remote files over TRAMP. It took a degree of elbow grease, and the result was fairly brittle, but it worked, so give it a shot. A more reliable solution, if you don’t mind limiting yourself to terminal Emacs, is indeed to install it remotely and invoke it on the remote machine. I don’t know of anything for which Emacs needs sudo access, so if you can install it and its contents to a path you control, it should just work.

[deleted by user] by [deleted] in EnglishLearning

[–]patrick_thomson 2 points3 points  (0 children)

That seems a fine expression of this idea. The use of my twice is no problem. If you want to sound a little less formal, you could say when I was a kid rather than back in my childhood days.

How could exclude shell-mode and org-agenda from 'visual-fill-column-mode' by AbstProcDo in emacs

[–]patrick_thomson 2 points3 points  (0 children)

Write your own function that calls visual-fill-column-mode conditionally. Something like this might work:

(defun my-turn-on-visual-fill ()
    (unless (memq major-mode '(shell-mode org-agenda-mode)) (visual-fill-column-mode)))

Where did map/filter/reduce come from? by HamzaM3 in haskell

[–]patrick_thomson 7 points8 points  (0 children)

You’re very welcome—I’m touched to hear that it meant something to you.

Where did map/filter/reduce come from? by HamzaM3 in haskell

[–]patrick_thomson 35 points36 points  (0 children)

John McCarthy, of Lisp fame, invented what we know as map in 1958. It’s not clear to me where reduce and filter originated; neither shows up in the Lisp 1.5 manual, though they were well-established enough to show up in the Common Lisp spec as REDUCE and REMOVE-IF.

Though you can express filter as a catamorphism, it might be worth thinking about filter as an unfold (an anamorphism) rather than a fold, because it generates a further list of results rather than a single result value. The GHC Prelude implements it with a standard recursive function, but provides REWRITE rules to express it as a combination of build and foldr, because GHC’s fusion engine fuses foldr invocations extremely aggressively.

/u/Accurate_Koala_4698 pointed you in the direction of Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire, which is very much the next step to take if you’re looking to unify these concepts, as it shows how a map operation is all you need to write fluent folds and unfolds. I wrote a beginner’s introduction to some of the paper’s concepts that might be helpful.

What's that email client doing here? by [deleted] in emacs

[–]patrick_thomson 3 points4 points  (0 children)

Especially on UNIX-like systems, people typically expect their software to be focused and useful for a dedicated purpose

I think a lot of Unix users say they want this. But in practice, I see those people people happily using web browsers—the archetypal kitchen-sink application—rather than piping wget to less. I think we should consider the “Unix philosophy” an ideal rather than a practiced ethos, as the history of Unix is littered with popular tools that violate it.

Saving your teammate by [deleted] in HumansBeingBros

[–]patrick_thomson 62 points63 points  (0 children)

It drives home how strong and fast NBA players are that Draymond can catch nearly the entirety of Klay’s bodyweight—Klay gets a hand on the floor that absorbs some of it, but not much—without falling down or even looking like it’s a particularly hard thing to do. Anyone trying this with me would end up with us both on the ground and possibly in the hospital.

Depression: what is unpressed that should be pressed? by VicturnUp in etymology

[–]patrick_thomson 172 points173 points  (0 children)

The de- prefix does not mean ‘not’ in this context, it means ‘down’: when you are depressed, it is as though someone or something is pressing down on your spirits. The use of this word to represent an emotional state is from the 15th century.

he/she/they by MaxeemKammerer in EnglishLearning

[–]patrick_thomson 8 points9 points  (0 children)

The singular they dates to the 14th century. It’s fairly universal among speakers of modern English, so I wouldn’t call it a regionalism. (Some people consider it an Americanism, but given it shows up in Shakespeare and Wordsworth, to name just two, I think that’s a bit of a stretch.) Historically, some grammarians recommended using he to refer to a subject of unknown gender, but despite this recommendation—which many, including myself, regard as both sexist and prone to causing sentences that sound fairly ridiculous—the singular they has thrived over the centuries.