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,9 +1,9 @@
import Hash2Pub.FediChord
import Data.Map.Internal.Debug (showTree)
import qualified Data.Map.Strict as Map
import Data.Map.Internal.Debug (showTree)
import qualified Data.Map.Strict as Map
import Hash2Pub.FediChord
giebMalCache :: [Integer] -> Map.Map NodeID ()
giebMalCache = Map.fromList . map (mkCacheEntry . fromInteger)
giebMalCache = Map.fromList . fmap (mkCacheEntry . fromInteger)
where
mkCacheEntry nodeid = (nodeid, ())
@ -18,11 +18,11 @@ nidLookupGT m = flip Map.lookupGT m . fromInteger
edgeCase1 :: IO ()
edgeCase1 = do
putStrLn "Let there be a Map with the keys [2^255+2^254+3, 2, 2^253], all keys are NodeIDs mod 2^256."
print testOverlap
print testOverlap
putStrLn "\nWhile (NodeID 2^255+2^254+3) > (NodeID 2^254 + 14) …"
print $ toNodeID (2^255+2^254+3) > toNodeID (2^254+14)
putStrLn "… and 2^255+2^254+3 is an element of the map…"
print $ Map.member (fromInteger 2^255+2^254+3) testOverlap
print $ Map.member (fromInteger (2^255+2^254+3)) testOverlap
putStrLn "… looking for an element larger than 2^254 + 14 doesn't yield any."
print $ nidLookupGT testOverlap (2^254+14)
putStrLn "\nThat's the tree of the map:"