<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi Christopher!<br>
<br>
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.<br>
<br>
I can give you an example of a recent library I wrote:
<a class="moz-txt-link-freetext" href="https://github.com/Kleidukos/effectful-contrib/blob/8ae8ad1d76e0c43610619fc04a545dc622bafb88/effectful-cache/src/Data/Cache/Effect.hs#L47-L57">https://github.com/Kleidukos/effectful-contrib/blob/8ae8ad1d76e0c43610619fc04a545dc622bafb88/effectful-cache/src/Data/Cache/Effect.hs#L47-L57</a><br>
<br>
Note that:<br>
</p>
<ul>
<li>Type variables are made explicit, and as such I annotate even
the simplest of them (with `:: Type`)</li>
<li>I align the separators (., => and ->)</li>
<li>I use stylish-haskell & hlint</li>
<li>If you want finer automated control, try something like
Britanny.<br>
</li>
</ul>
<br>
<div class="moz-cite-prefix">Le 07/08/2021 à 21:18, Christopher
Conforti a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:20210807151845.6b80d63d@ccc-pc.confortihome.net">
<pre class="moz-quote-pre" wrap="">Hi List,
I'm a relatively new Haskeller. I've gotten the syntax of the
language more or less down, and I'm slowly expanding my vocabulary. I've
found in other languages that my coding style and how my code is
organized affect both the quality of my code and how easy it is to
understand.
'Coding style' refers to how code is organized within a block. For
example:
```
foo bar baz bing = x + y * z
```
versus:
```
foo
bar
baz
bing
= x + y * z
```
Code organization refers both to how code is organized within a
source file (i.e., how code blocks are arranged, how they're grouped,
so on) and how source files themselves are organized.
I've got the first part down--I've developed a code style that I'm
satisfied with, I've tried to fine-tune my style to make maximum
effective use of available space (limiting myself to 72 columns, and a
block size of no more than 30 lines) so as to force myself to extract
and abtract away unnecessary details.
The second part is the one I'm having trouble with. There are so many
ways to organize one's code that I don't even know where to begin
developing a method that I like other than to ask other Haskellers how
they do it and why they like doing it that way.
So there you have it: How do you organize your code, and why?
Cheers!
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a>
Only members subscribed via the mailman list are allowed to post.</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Hécate ✨
🐦: @TechnoEmpress
IRC: Hecate
WWW: <a class="moz-txt-link-freetext" href="https://glitchbra.in">https://glitchbra.in</a>
RUN: BSD</pre>
</body>
</html>