branch: elpa/haskell-tng-mode commit ee07f6d8632ee905fb9a7537c3c50658341f93d3 Author: Tseen She <ts33n....@gmail.com> Commit: Tseen She <ts33n....@gmail.com>
type indentation tests --- haskell-tng-smie.el | 1 + test/haskell-tng-indent-test.el | 1 + test/src/indentation.hs | 23 +++++++++++++++++ test/src/indentation.hs.append.indent | 48 ++++++++++++++++++++++++++++++++++- test/src/indentation.hs.insert.indent | 48 ++++++++++++++++++++++++++++++++++- test/src/indentation.hs.layout | 23 +++++++++++++++++ test/src/indentation.hs.lexer | 23 +++++++++++++++++ test/src/indentation.hs.reindent | 48 ++++++++++++++++++++++++++++++++++- test/src/indentation.hs.sexps | 25 +++++++++++++++++- test/src/indentation.hs.syntax | 23 +++++++++++++++++ 10 files changed, 259 insertions(+), 4 deletions(-) diff --git a/haskell-tng-smie.el b/haskell-tng-smie.el index 15d27de..91aaa65 100644 --- a/haskell-tng-smie.el +++ b/haskell-tng-smie.el @@ -65,6 +65,7 @@ ;; operators all have the same precedence (infixexp + ;; TODO : and ': should lex as SYMID (id ":" infixexp) ;; keyword infix (id "':" infixexp) ;; DataKinds (id "SYMID" infixexp)) diff --git a/test/haskell-tng-indent-test.el b/test/haskell-tng-indent-test.el index cd2e0a3..b2fdb09 100644 --- a/test/haskell-tng-indent-test.el +++ b/test/haskell-tng-indent-test.el @@ -15,6 +15,7 @@ ;; FIXME implement more indentation rules ;; ;; TODO multiline type signatures +;; TODO ImplicitParams in type signatures (without parens) ;; TODO if/then/else ;; TODO reindenting needs attention, it's all over the radar diff --git a/test/src/indentation.hs b/test/src/indentation.hs index 3a95061..c962b82 100644 --- a/test/src/indentation.hs +++ b/test/src/indentation.hs @@ -121,3 +121,26 @@ tuples2 = ( tuples3 = ( foo , bar ) + +types1 :: a -> b -> c + +types2 :: + a + -> b + -> c + +types3 :: + Monad m + => a + -> b + -> c + +types4 :: Monad m + => (?log :: HasLogger m) + => a + -> b + -> c + +types5 :: (Monad m, MonadReader Foo m) => + (?log :: HasLogger m) => + a -> b -> c diff --git a/test/src/indentation.hs.append.indent b/test/src/indentation.hs.append.indent index c52975e..cb53038 100644 --- a/test/src/indentation.hs.append.indent +++ b/test/src/indentation.hs.append.indent @@ -245,4 +245,50 @@ tuples3 = ( foo , bar ) v 1 -v 1 \ No newline at end of file +v 1 +types1 :: a -> b -> c +v + +v +types2 :: +v + a +v 1 + -> b +v 1 2 + -> c +v 1 2 + +v 1 2 +types3 :: +v + Monad m +v 1 + => a +v 1 2 + -> b +v 1 2 + -> c +v 1 2 + +v 1 2 +types4 :: Monad m +v + => (?log :: HasLogger m) +v 1 + => a +v 1 + -> b +v 1 + -> c +v 1 + +v 1 +types5 :: (Monad m, MonadReader Foo m) => +v + (?log :: HasLogger m) => +v 1 + a -> b -> c +v 1 + +v 1 \ No newline at end of file diff --git a/test/src/indentation.hs.insert.indent b/test/src/indentation.hs.insert.indent index e9936c4..3e14b25 100644 --- a/test/src/indentation.hs.insert.indent +++ b/test/src/indentation.hs.insert.indent @@ -243,4 +243,50 @@ v tuples3 = ( foo , 1 v bar ) -v 1 \ No newline at end of file +v 1 + +v 1 +types1 :: a -> b -> c +v + +v +types2 :: +2 1 v + a +2 1 v + -> b +2 1 v + -> c +v 1 2 + +v 1 2 +types3 :: +2 1 v + Monad m +2 1 v + => a +1 v 2 + -> b +2 1 v + -> c +v 1 2 + +v 1 2 +types4 :: Monad m +1 v + => (?log :: HasLogger m) +1 v + => a +1 v + -> b +2 1 v + -> c +v 1 + +v 1 +types5 :: (Monad m, MonadReader Foo m) => +2 v 1 + (?log :: HasLogger m) => +1 v + a -> b -> c +v 1 \ No newline at end of file diff --git a/test/src/indentation.hs.layout b/test/src/indentation.hs.layout index a252c8d..4eae865 100644 --- a/test/src/indentation.hs.layout +++ b/test/src/indentation.hs.layout @@ -121,4 +121,27 @@ module Indentation where ;tuples3 = ( foo , bar ) + +;types1 :: a -> b -> c + +;types2 :: + a + -> b + -> c + +;types3 :: + Monad m + => a + -> b + -> c + +;types4 :: Monad m + => (?log :: HasLogger m) + => a + -> b + -> c + +;types5 :: (Monad m, MonadReader Foo m) => + (?log :: HasLogger m) => + a -> b -> c } \ No newline at end of file diff --git a/test/src/indentation.hs.lexer b/test/src/indentation.hs.lexer index cd8d2e8..065623e 100644 --- a/test/src/indentation.hs.lexer +++ b/test/src/indentation.hs.lexer @@ -121,4 +121,27 @@ VARID ; VARID = « VARID , VARID » + +; VARID :: VARID -> VARID -> VARID + +; VARID :: +VARID +-> VARID +-> VARID + +; VARID :: +CONID VARID +=> VARID +-> VARID +-> VARID + +; VARID :: CONID VARID +=> « VARID :: CONID VARID » +=> VARID +-> VARID +-> VARID + +; VARID :: « CONID VARID , CONID CONID VARID » => +« VARID :: CONID VARID » => +VARID -> VARID -> VARID } diff --git a/test/src/indentation.hs.reindent b/test/src/indentation.hs.reindent index af1c5a31..0e14fdf 100644 --- a/test/src/indentation.hs.reindent +++ b/test/src/indentation.hs.reindent @@ -243,4 +243,50 @@ v v 1 tuples3 = ( foo , 1 v - bar ) \ No newline at end of file + bar ) +v 1 + +v 1 +types1 :: a -> b -> c +v + +v 1 +types2 :: +2 1 v + a +v 1 2 + -> b +v 1 2 + -> c +v 1 2 + +v 2 1 +types3 :: +2 1 v + Monad m +2 1 v + => a +v 1 2 + -> b +v 1 2 + -> c +v 1 2 + +v 2 3 1 +types4 :: Monad m +1 v + => (?log :: HasLogger m) +1 v + => a +v 1 + -> b +v 1 + -> c +v 1 + +v 2 1 +types5 :: (Monad m, MonadReader Foo m) => +2 v 1 + (?log :: HasLogger m) => +1 v + a -> b -> c \ No newline at end of file diff --git a/test/src/indentation.hs.sexps b/test/src/indentation.hs.sexps index ee7ba3c..d0c9771 100644 --- a/test/src/indentation.hs.sexps +++ b/test/src/indentation.hs.sexps @@ -120,5 +120,28 @@ )) ((tuples3) = ( (foo) , - (bar) )))))))))))))) + (bar) )) + +((types1) (::) (a) -> (b) -> (c)) + +((types2) (::) + (a) + -> (b) + -> (c)) + +((types3) (::) + (Monad) (m) + (=>) (a) + -> (b) + -> (c)) + +((types4) (::) (Monad) (m) + (=>) ((?log) (::) (HasLogger) (m)) + (=>) (a) + -> (b) + -> (c)) + +((types5) (::) ((Monad) (m), (MonadReader) (Foo) (m)) (=>) + ((?log) (::) (HasLogger) (m)) (=>) + (a) -> (b) -> (c)))))))))))))) ))) \ No newline at end of file diff --git a/test/src/indentation.hs.syntax b/test/src/indentation.hs.syntax index 7c8efad..4e75ba8 100644 --- a/test/src/indentation.hs.syntax +++ b/test/src/indentation.hs.syntax @@ -121,3 +121,26 @@ wwwwwww _ (> > wwwwwww _ ( www .> www )> +> +wwwwww __ w __ w __ w> +> +wwwwww __> + w> + __ w> + __ w> +> +wwwwww __> + wwwww w> + __ w> + __ w> + __ w> +> +wwwwww __ wwwww w> + __ (_www __ wwwwwwwww w)> + __ w> + __ w> + __ w> +> +wwwwww __ (wwwww w. wwwwwwwwwww www w) __> + (_www __ wwwwwwwww w) __> + w __ w __ w>