summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2012-09-15 14:14:14 +0200
committerJasper Van der Jeugt <m@jaspervdj.be>2012-09-15 14:14:14 +0200
commit6ffe66c0c06203cb2a669aa46a6906ced77a8866 (patch)
treecb17721dfe87d9e4c834999b4bf5655ac165e6c6
parent5fb59fc4dcf6904d87024ee13b37122eb87b29d5 (diff)
parent9e6636067c1fd05ecc8932b8f268c33b548e7f4b (diff)
downloadstylish-haskell-6ffe66c0c06203cb2a669aa46a6906ced77a8866.tar.gz
Merge branch 'master' of github.com:jaspervdj/stylish-haskell
-rw-r--r--app/Main.hs (renamed from src/Main.hs)6
-rw-r--r--src/Language/Haskell/Stylish.hs61
-rw-r--r--stylish-haskell.cabal27
3 files changed, 80 insertions, 14 deletions
diff --git a/src/Main.hs b/app/Main.hs
index f880f1d..f97d45d 100644
--- a/src/Main.hs
+++ b/app/Main.hs
@@ -16,11 +16,7 @@ import System.IO.Strict (readFile)
--------------------------------------------------------------------------------
-import Paths_stylish_haskell (version)
-import StylishHaskell
-import StylishHaskell.Config
-import StylishHaskell.Step
-import StylishHaskell.Verbose
+import Language.Haskell.Stylish
--------------------------------------------------------------------------------
diff --git a/src/Language/Haskell/Stylish.hs b/src/Language/Haskell/Stylish.hs
new file mode 100644
index 0000000..ccad070
--- /dev/null
+++ b/src/Language/Haskell/Stylish.hs
@@ -0,0 +1,61 @@
+module Language.Haskell.Stylish
+ ( -- * Run
+ runSteps
+ -- * Steps
+ , imports
+ , languagePragmas
+ , records
+ , tabs
+ , trailingWhitespace
+ , unicodeSyntax
+ -- ** Data types
+ , Imports.Align (..)
+ , LanguagePragmas.Style (..)
+ -- ** Helpers
+ , stepName
+ -- * Config
+ , module StylishHaskell.Config
+ -- * Misc
+ , module StylishHaskell.Verbose
+ , version
+ , Lines
+ , Step
+ ) where
+
+import StylishHaskell
+import StylishHaskell.Config
+import StylishHaskell.Step
+import StylishHaskell.Verbose
+import Paths_stylish_haskell (version)
+
+import qualified StylishHaskell.Step.Imports as Imports
+import qualified StylishHaskell.Step.LanguagePragmas as LanguagePragmas
+import qualified StylishHaskell.Step.Records as Records
+import qualified StylishHaskell.Step.Tabs as Tabs
+import qualified StylishHaskell.Step.TrailingWhitespace as TrailingWhitespace
+import qualified StylishHaskell.Step.UnicodeSyntax as UnicodeSyntax
+
+imports :: Int -- ^ columns
+ -> Imports.Align
+ -> Step
+imports = Imports.step
+
+languagePragmas :: Int -- ^ columns
+ -> LanguagePragmas.Style
+ -> Bool -- ^ remove redundant?
+ -> Step
+languagePragmas = LanguagePragmas.step
+
+records :: Step
+records = Records.step
+
+tabs :: Int -- ^ number of spaces
+ -> Step
+tabs = Tabs.step
+
+trailingWhitespace :: Step
+trailingWhitespace = TrailingWhitespace.step
+
+unicodeSyntax :: Bool -- ^ add language pragma?
+ -> Step
+unicodeSyntax = UnicodeSyntax.step
diff --git a/stylish-haskell.cabal b/stylish-haskell.cabal
index 684d798..88ce3e3 100644
--- a/stylish-haskell.cabal
+++ b/stylish-haskell.cabal
@@ -1,5 +1,5 @@
Name: stylish-haskell
-Version: 0.3.2.0
+Version: 0.4.0.0
Synopsis: Haskell code prettifier
Homepage: https://github.com/jaspervdj/stylish-haskell
License: BSD3
@@ -21,12 +21,11 @@ Description:
Data-files:
.stylish-haskell.yaml
-Executable stylish-haskell
- Ghc-options: -Wall
+Library
+ Exposed-modules: Language.Haskell.Stylish
Hs-source-dirs: src
- Main-is: Main.hs
-
- Other-modules:
+ Ghc-options: -Wall
+ other-modules:
Paths_stylish_haskell
StylishHaskell
StylishHaskell.Block
@@ -47,16 +46,25 @@ Executable stylish-haskell
aeson >= 0.6 && < 0.7,
base >= 4 && < 5,
bytestring >= 0.9 && < 0.10,
- cmdargs >= 0.9 && < 0.10,
containers >= 0.3 && < 0.6,
directory >= 1.1 && < 1.2,
filepath >= 1.1 && < 1.4,
haskell-src-exts >= 1.13 && < 1.14,
mtl >= 2.0 && < 2.2,
- strict >= 0.3 && < 0.4,
syb >= 0.3 && < 0.4,
yaml >= 0.7 && < 0.9
+Executable stylish-haskell
+ Ghc-options: -Wall
+ Hs-source-dirs: app
+ Main-is: Main.hs
+
+ Build-depends:
+ base >= 4 && < 5,
+ cmdargs >= 0.9 && < 0.11,
+ strict >= 0.3 && < 0.4,
+ stylish-haskell
+
Test-suite stylish-haskell-tests
Ghc-options: -Wall
Hs-source-dirs: src tests
@@ -64,6 +72,7 @@ Test-suite stylish-haskell-tests
Type: exitcode-stdio-1.0
Other-modules:
+ StylishHaskell.Parse.Tests
StylishHaskell.Step.Imports.Tests
StylishHaskell.Step.LanguagePragmas.Tests
StylishHaskell.Step.Records.Tests
@@ -80,7 +89,7 @@ Test-suite stylish-haskell-tests
aeson >= 0.6 && < 0.7,
base >= 4 && < 5,
bytestring >= 0.9 && < 0.10,
- cmdargs >= 0.9 && < 0.10,
+ cmdargs >= 0.9 && < 0.11,
containers >= 0.3 && < 0.6,
directory >= 1.1 && < 1.2,
filepath >= 1.1 && < 1.4,