• Joined on 2020-05-19
Hecate commented on pull request schmittlauch/Hash2Pub#69 2020-09-05 15:46:10 +02:00
Improve general readability

Reverted.

Hecate pushed to readability at Hecate/Hash2Pub 2020-09-05 15:45:49 +02:00
7d833e064b Improve readability
51d9fbadad Improve readability
Compare 2 commits »
Hecate commented on pull request schmittlauch/Hash2Pub#69 2020-09-05 15:39:10 +02:00
Improve general readability

@schmittlauch Yep, it's ready to be merged.

Hecate commented on pull request schmittlauch/Hash2Pub#69 2020-09-05 15:38:36 +02:00
Improve general readability

Do I revert this change?

Hecate pushed to readability at Hecate/Hash2Pub 2020-09-05 13:48:47 +02:00
51d9fbadad Improve readability
9521863a23 Improve readability
Compare 2 commits »
Hecate created pull request schmittlauch/Hash2Pub#69 2020-09-05 13:16:07 +02:00
Improve general readability
Hecate commented on pull request schmittlauch/Hash2Pub#17 2020-05-31 22:24:59 +02:00
Linting integration

I haven't set it up as a pre-commit hook yet as I don't fully understand it, but running it manually before a commit does only complain about unclean working state.

Then maybe the workflow of this script isn't suited for you. Which editor are you using?

Do you mean that I then manually shall invoke stylish-haskell -i on each Haskell file in the repo? Couldn't I just let the pre-commit script make that do automatically,

NOPE! If you do so, stylish-haskell will edit the files in-place, then return the return code 0, then you'll be prompted to enter the commit's message, which won't include the edited files, because you couldn't add them in the meantime. Basically, you'll have to commit a fixup afterwards.

syntax errors, incomplete implementations)

stylish-haskell will most definitely stumble on syntax errors. My vim bindings apply it each time I save the file, so it gets formatted in-place.

Hecate commented on pull request schmittlauch/Hash2Pub#17 2020-05-23 18:04:06 +02:00
Linting integration

If run as a pre-commit hook, wouldn't it always complain about a dirty working directory then as before a commit changes aren't commited yet?

It will! Sorry for the confusion 😵

What I meant to say is that the script uses the in-place editing feature of stylish-haskell to then detect files that need to be passed through by checking the git status of those files (since they were edited by stylish-haskell, they are now unstaged).

But the important thing here is that since it returns 1 as an exit code, it will abort the commit step and let you apply stylish-haskell on the incriminated files.

Am I clear enough? I haven't had much sleep recently…

Hecate commented on pull request schmittlauch/Hash2Pub#17 2020-05-23 17:56:15 +02:00
Linting integration

@hecate I do not fully understand what's the best way of using stylish-haskell in my workflow:

I have an editor plugin that calls it for the current buffer that I am saving.

The helper script can be run in a CI action or a pre-commit git hook (very useful, I also use that for hlint).

Hecate commented on issue schmittlauch/Hash2Pub#19 2020-05-19 19:43:05 +02:00
background job processing for delivering ActivityPub pushes

I personally think Postgres is far from being "overkill" if you are going to build some kind of highly-connected network service, especially if you wish to do some retention. Of course it's not like sqlite3, but it's a fairly standard tool on the "engineering" side of things. :)

Hecate commented on issue schmittlauch/Hash2Pub#19 2020-05-19 19:36:40 +02:00
background job processing for delivering ActivityPub pushes

@schmittlauch If you wish to use one of the best and full-featured libraries on Hackage, I can only recommend odd-jobs.

Hecate commented on issue schmittlauch/Hash2Pub#18 2020-05-19 19:35:00 +02:00
Main.hs should not live in src/

Yes, Pandoc, with some other high-profile stuff, have always done things "their own way" for quite some time. :)

Regarding more “pedestrian” open-source projects, I can point to mini-lambda, top-apps, causal-haskell. Unfortunately I can't really point you to the closed-source projects I had the opportunity to work on, so you'll have to believe me on those. :P

Hecate opened issue schmittlauch/Hash2Pub#18 2020-05-19 19:00:32 +02:00
Main.hs should not live in src/
Hecate pushed to master at Hecate/Hash2Pub 2020-05-19 18:33:14 +02:00
b8eeb852da Merge pull request 'Linting integration' (#17) from Hecate/Hash2Pub:hlint-configuration into master
7fd369c8c5 add stylish as haskell linter
41e999ed99 Linting integration
Compare 3 commits »
Hecate commented on pull request schmittlauch/Hash2Pub#17 2020-05-19 13:32:02 +02:00
Linting integration

What is the import oordering you suggest?

Two separated blocks for non-hash2pub modules and hash2pub modules. Whether or not they belong to the Haskell platform is irrelevant: They will get ordered alphabetically whilst staying in their lane.

See:

import Control.Monad
import Data.Time

import Hash2Pub.ASN1Coding
import Hash2Pub.FediChord

Why should pure be preferred over return in general? I always tried to use both of them depending on the context: When writing applicative-style functions, I used pure to make the applicative nature of the functions obvious, when messing around inside monads (e.g. with do notation) I used return to highlight the monad stuff, even when pure could've been enough (example: Maybe).

This is an interesting point, and I see why you do that. However, there are two benefits, on two different dimensions, for preferring pure to return:

  • return has a strong, strong history of being a keyword in imperative languages to send back the value produced by the function, and this semantic overlap has been described as, at best confusing, as worse outright dangerous because newcomers start to ascribe some kind of magic properties.
  • The Monad of no Return proposal by Ben Gamari explains in length why return is mostly an artifact of the past:

Consequently, the Monad class is left with a now redundant return method as a historic artifact, as there's no compelling reason to have pure and return implemented differently. More to the point, this redundancy violates the "making illegal states unrepresentable" idiom: Due to the default implementation of return this redundancy leads to error-prone situations which aren't caught by the compiler; for instance, when return is removed while the Applicative instance is left with a pure = return definition, this leads to a cyclic definition which can be quite tedious to debug as it only manifests at runtime by a hanging process. Traditionally, return is often used where pure would suffice today, forcing a Monad constraint even if a weaker Applicative would have sufficed. As a result, language extensions like ApplicativeDo[3] have to rewrite return to weaken its Monad m => constraint to Applicative m => in order to benefit existing code at the cost of introducing magic behavior at the type level.

Hecate created pull request schmittlauch/Hash2Pub#17 2020-05-19 12:47:11 +02:00
Linting integration
Hecate pushed to hlint-configuration at Hecate/Hash2Pub 2020-05-19 12:44:52 +02:00
41e999ed99 Linting integration
6009fb1d2e HLint integration
Compare 2 commits »
Hecate pushed to hlint-configuration at Hecate/Hash2Pub 2020-05-19 12:39:40 +02:00
6009fb1d2e HLint integration
Hecate created repository Hecate/Hash2Pub 2020-05-19 12:05:29 +02:00