Skip to content

Commit c958910

Browse files
committed
Merge pull request #1130 from gracjan/pr-align-data
Align data declaration contructors in indentation
2 parents b562d05 + dfb3afb commit c958910

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

haskell-indentation.el

+4-2
Original file line numberDiff line numberDiff line change
@@ -648,8 +648,10 @@ For example
648648
(haskell-indentation-add-indentation current-indent)
649649
(throw 'parse-end nil)))
650650
((string= current-token "=")
651-
(haskell-indentation-separated
652-
#'haskell-indentation-expression "|" "deriving"))
651+
(haskell-indentation-with-starter
652+
(lambda ()
653+
(haskell-indentation-separated
654+
#'haskell-indentation-expression "|" "deriving"))))
653655
((string= current-token "where")
654656
(haskell-indentation-with-starter
655657
#'haskell-indentation-expression-layout nil))))

tests/haskell-indentation-tests.el

+5-5
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ instance Bar Int
664664
(hindent-test "32 allow type operators" "
665665
data (:.) a b = a :. b
666666
"
667-
(2 0 2))
667+
(2 0 16))
668668

669669
(hindent-test "33* parse #else in CPP" "
670670
#ifdef FLAG
@@ -681,7 +681,7 @@ data T = T {
681681
}
682682
683683
"
684-
(5 0 2))
684+
(5 0 9))
685685

686686
(hindent-test "35 baroque construct which causes parse error" "
687687
az = Projection
@@ -854,7 +854,7 @@ newtype instance T Char = TC Bool"
854854
(1 0)
855855
(2 0)
856856
(3 0)
857-
(4 0 2))
857+
(4 0 26))
858858

859859
(hindent-test "52a* module simplest case two lines" "
860860
module A.B
@@ -896,13 +896,13 @@ foo x
896896
(2 2)
897897
(3 2))
898898

899-
(hindent-test "55* data constructor on separate line" "
899+
(hindent-test "55 data constructor on separate line" "
900900
data Foo = Bar
901901
| Baz"
902902
(1 0)
903903
(2 9))
904904

905-
(hindent-test "55a* deriving below aligned data constructors" "
905+
(hindent-test "55a deriving below aligned data constructors" "
906906
data Foo = Bar
907907
| Baz
908908
deriving (Show)"

0 commit comments

Comments
 (0)