Linting integration

This commit brings in an HLint configuration file
and several recommended modifications such as:

* End-of-line extra spaces removal;
* Import lines ordering;
* Redundant $ removal;
* Generalisation of ++ and map to <> and fmap;
* Preferring `pure` over `return`;
* Removing extraenous extensions.

And finally, a `stylish-haskell` helper script
that detects if code files are dirty. Can be useful for CI,
although manually calling it can be nice if you would rather
first implement then beautify.
This commit is contained in:
Hécate 2020-05-19 12:29:15 +02:00
parent d049b65f1e
commit 41e999ed99
11 changed files with 281 additions and 248 deletions

View file

@ -1,10 +1,10 @@
module Main where
import System.Environment
import Data.IP (IPv6, toHostAddress6) -- iproute, just for IPv6 string parsing
import Control.Concurrent
import Control.Concurrent
import Data.IP (IPv6, toHostAddress6)
import System.Environment
import Hash2Pub.FediChord
import Hash2Pub.FediChord
main :: IO ()
main = do
@ -20,12 +20,12 @@ main = do
-- idea: list of bootstrapping nodes, try joining within a timeout
-- stop main thread from terminating during development
getChar
return ()
pure ()
readConfig :: IO FediChordConf
readConfig = do
confDomainString : ipString : portString : _ <- getArgs
return $ FediChordConf {
pure $ FediChordConf {
confDomain = confDomainString
, confIP = toHostAddress6 . read $ ipString
, confDhtPort = read portString