diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-08-12 04:27:03 +0200 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-08-12 04:27:03 +0200 |
commit | 1c0ad54f6ff6bae7c9ec3211911b329006dc8ea3 (patch) | |
tree | bc386daa645f41344ebd229e8915daf86a80cca6 | |
parent | 74216b45db7648fc69662310c4900748110d73b9 (diff) | |
download | stylish-haskell-1c0ad54f6ff6bae7c9ec3211911b329006dc8ea3.tar.gz |
Use the new Change in records
-rw-r--r-- | src/StylishHaskell/Step/Records.hs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/StylishHaskell/Step/Records.hs b/src/StylishHaskell/Step/Records.hs index a754428..ae9e0c4 100644 --- a/src/StylishHaskell/Step/Records.hs +++ b/src/StylishHaskell/Step/Records.hs @@ -3,13 +3,14 @@ module StylishHaskell.Step.Records where -------------------------------------------------------------------------------- +import Control.Arrow (second) import Data.List (nub) import qualified Language.Haskell.Exts.Annotated as H -------------------------------------------------------------------------------- -import StylishHaskell.Block import StylishHaskell.Editor +import StylishHaskell.Util -------------------------------------------------------------------------------- @@ -24,12 +25,13 @@ records modu = -------------------------------------------------------------------------------- -- | Align the types of a field -{- -alignType :: Int -> H.FieldDecl H.SrcSpan -> Int -> Change String -alignType longest (H.FieldDecl _ names _) line = +alignType :: Int -> H.FieldDecl H.SrcSpan -> Change String +alignType longest (H.FieldDecl srcSpan _ _) = + changeLine (H.srcSpanStartLine srcSpan) alignType' where - end = --} + alignType' str = + let (pre, post) = second (drop 2) $ break (== ':') str + in [padRight longest pre ++ post] -------------------------------------------------------------------------------- |