Skip to content

Commit 2f52e1f

Browse files
authored
Merge pull request #1 from swift-nav/mfine/stylish
Formatting with Stylish
2 parents 6ad36f8 + 93069ac commit 2f52e1f

File tree

5 files changed

+83
-19
lines changed

5 files changed

+83
-19
lines changed

.stylish-haskell.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# stylish-haskell configuration file
2+
# ==================================
3+
4+
# The stylish-haskell tool is mainly configured by specifying steps. These steps
5+
# are a list, so they have an order, and one specific step may appear more than
6+
# once (if needed). Each file is processed by these steps in the given order.
7+
steps:
8+
# Import cleanup
9+
- imports:
10+
# There are different ways we can align names and lists.
11+
#
12+
# - global: Align the import names and import list throughout the entire
13+
# file.
14+
#
15+
# - file: Like global, but don't add padding when there are no qualified
16+
# imports in the file.
17+
#
18+
# - group: Only align the imports per group (a group is formed by adjacent
19+
# import lines).
20+
#
21+
# - none: Do not perform any alignment.
22+
#
23+
# Default: global.
24+
align: file
25+
26+
# Language pragmas
27+
- language_pragmas:
28+
# We can generate different styles of language pragma lists.
29+
#
30+
# - vertical: Vertical-spaced language pragmas, one per line.
31+
#
32+
# - compact: A more compact style.
33+
#
34+
# - compact_line: Similar to compact, but wrap each line with
35+
# `{-#LANGUAGE #-}'.
36+
#
37+
# Default: vertical.
38+
style: vertical
39+
40+
# stylish-haskell can detect redundancy of some language pragmas. If this
41+
# is set to true, it will remove those redundant pragmas. Default: true.
42+
remove_redundant: true
43+
44+
# Replace tabs by spaces. This is disabled by default.
45+
# - tabs:
46+
# # Number of spaces to use for each tab. Default: 8, as specified by the
47+
# # Haskell report.
48+
# spaces: 8
49+
50+
# Remove trailing whitespace
51+
- trailing_whitespace: {}
52+
53+
# A common setting is the number of columns (parts of) code will be wrapped
54+
# to. Different steps take this into account. Default: 80.
55+
columns: 94
56+
57+
# Sometimes, language extensions are specified in a cabal file or from the
58+
# command line instead of using language pragmas in the file. stylish-haskell
59+
# needs to be aware of these, so it can parse the file correctly.
60+
#
61+
# No language extensions are enabled by default.
62+
language_extensions:
63+
- MultiParamTypeClasses

main/labsat-cli.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
-- | LabSat telnet interface
66
--
7+
import Labsat
78
import Options.Generic
89
import Preamble
9-
import Labsat
1010

1111
-- | Args
1212
--

src/Labsat.hs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
{-# LANGUAGE FlexibleContexts #-}
2-
{-# LANGUAGE NoImplicitPrelude #-}
3-
{-# LANGUAGE OverloadedStrings #-}
1+
{-# LANGUAGE FlexibleContexts #-}
2+
{-# LANGUAGE NoImplicitPrelude #-}
3+
{-# LANGUAGE OverloadedStrings #-}
44

55
module Labsat where
66

7-
import Control.Concurrent.Async.Lifted (race_)
8-
import Control.Concurrent.Lifted (threadDelay)
7+
import Control.Concurrent.Async.Lifted (race_)
8+
import Control.Concurrent.Lifted (threadDelay)
99
import Data.Attoparsec.ByteString
10-
import qualified Data.ByteString as BS
11-
import qualified Data.ByteString.Char8 as C
10+
import qualified Data.ByteString as BS
11+
import qualified Data.ByteString.Char8 as C
1212
import Data.Conduit
1313
import Data.Conduit.Attoparsec
14-
import qualified Data.Conduit.Binary as B
14+
import qualified Data.Conduit.Binary as B
1515
import Data.Conduit.Network
16-
import Data.Text.Encoding (encodeUtf8)
16+
import Data.Text.Encoding (encodeUtf8)
1717
import Labsat.Ctx
1818
import Labsat.Parser
1919
import Labsat.Types
2020
import Preamble
21-
import System.IO hiding (print, putStrLn)
21+
import System.IO hiding (print, putStrLn)
2222

2323

2424
--------------------------------------------------------------------------------

src/Labsat/Ctx.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
{-# LANGUAGE ConstraintKinds #-}
2-
{-# LANGUAGE FlexibleContexts #-}
3-
{-# LANGUAGE NoImplicitPrelude #-}
4-
{-# LANGUAGE TemplateHaskell #-}
1+
{-# LANGUAGE ConstraintKinds #-}
2+
{-# LANGUAGE FlexibleContexts #-}
3+
{-# LANGUAGE NoImplicitPrelude #-}
4+
{-# LANGUAGE TemplateHaskell #-}
55

66
module Labsat.Ctx where
77

src/Labsat/Parser.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
{-# LANGUAGE NoImplicitPrelude #-}
2-
{-# LANGUAGE OverloadedStrings #-}
2+
{-# LANGUAGE OverloadedStrings #-}
33

44
module Labsat.Parser where
55

66

7-
import qualified Data.ByteString as BS
87
import Data.Attoparsec.ByteString
9-
import Data.Attoparsec.ByteString.Char8 (char, decimal, double, isDigit_w8, isEndOfLine, scientific, signed)
8+
import Data.Attoparsec.ByteString.Char8 (char, decimal, double, isDigit_w8,
9+
isEndOfLine, scientific, signed)
10+
import qualified Data.ByteString as BS
1011
import Labsat.Types
11-
import Preamble hiding (takeWhile)
12+
import Preamble hiding (takeWhile)
1213

1314

1415
--------------------------------------------------------------------------------

0 commit comments

Comments
 (0)