[Haskell-cafe] Organizing your code files

Christopher Conforti christopher at conforti.xyz
Wed Aug 11 22:27:46 UTC 2021


On Sun, 8 Aug 2021 08:50:24 +0200
Hécate <hecate at glitchbra.in> wrote:

> On my end, I make use of automated style formatters, so that this
> kind of thing can be kept consistent during CI. I invite you not to
> think too much about the micro-details of code styles, but rather
> find a tool that you can configure so that your style can be enforced
> automatically. You'll be able to spend more cycles on programme
> development.

Indeed, this is the direction I'm heading. However, I'm doing it by
hand first so I can refine my methods to a point I'm satisfied with,
and then build the automation afterwards, hopefully doing it right the
first time. I place value on this because I plan to stick with the same
style throughout all my code so that I can read and reuse my own code 30
years from now and not have to think about how much I hate past me.

The sort of information I'm after answers questions similar to and
including, "Why put this typeclass in this source file and not that
one?" and "Should I put all my type signatures, typeclasses and data
structures at the top? At the bottom? Should I put them in a separate
source file?"

Having outside perspectives from actual people that I'm having
conversations with will help me both learn the finer points of the
topic (from actual programmers) and piece together a strategy I'm happy
with.

On Sun, 8 Aug 2021 08:50:24 +0200
Hécate <hecate at glitchbra.in> wrote:
> Note that:
> 
>   * Type variables are made explicit, and as such I annotate even the
>     simplest of them (with `:: Type`)
>   * I align the separators (., => and ->)
>   * I use stylish-haskell & hlint
>   * If you want finer automated control, try something like Britanny.

Your code is a pleasure to read; I shall enjoy studying it. :-)

-- 
Christopher Conforti
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20210811/833a4125/attachment.sig>


More information about the Haskell-Cafe mailing list