emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/haskell-tng-mode 0506391 109/385: module ... where indents


From: ELPA Syncer
Subject: [nongnu] elpa/haskell-tng-mode 0506391 109/385: module ... where indents to 0
Date: Tue, 5 Oct 2021 23:59:11 -0400 (EDT)

branch: elpa/haskell-tng-mode
commit 05063912dba1a4a56ba34be1b05065ccd138c000
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>

    module ... where indents to 0
---
 haskell-tng-smie.el              | 11 ++++++++---
 test/src/grammar.hs.sexps        |  4 ++--
 test/src/layout.hs.insert.indent |  2 +-
 test/src/layout.hs.sexps         |  4 ++--
 test/src/medley.hs.insert.indent |  8 ++++----
 5 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/haskell-tng-smie.el b/haskell-tng-smie.el
index 53dc63f..0a7cb6c 100644
--- a/haskell-tng-smie.el
+++ b/haskell-tng-smie.el
@@ -62,6 +62,7 @@
 
       ;; WLDOs
       (wldo
+       ("module" blk "where" blk)
        (blk "where" blk)
        ("let" blk "in")
        ("do" blk)
@@ -97,9 +98,11 @@
 
     (:after
      (pcase arg
-       ((or "::" "=" "where" "let" "do" "of")
-        ;; TODO module where should have column 0
-        ;; TODO wtf is happening with the line "class Get a s where"
+       ("where"
+        (if (smie-rule-parent-p "module")
+            '(column . 0)
+          smie-indent-basic))
+       ((or "::" "=" "let" "do" "of")
         smie-indent-basic)
        ))
 
@@ -175,6 +178,8 @@ current line."
    #'haskell-tng-smie:indent-cycle
    nil 'local)
 
+  ;; TODO alternative to indent-for-tab-command that does alignment
+
   (smie-setup
    haskell-tng-smie:grammar
    #'haskell-tng-smie:rules
diff --git a/test/src/grammar.hs.sexps b/test/src/grammar.hs.sexps
index 1f02b76..18e71bd 100644
--- a/test/src/grammar.hs.sexps
+++ b/test/src/grammar.hs.sexps
@@ -1,8 +1,8 @@
 -- | Tests for grammar rules i.e. sexps, not indentation
-((module) (Foo.(Bar)) (where)
+((module (Foo.(Bar)) (where)
 
 ((calc) (::) (Int) -> (Int)
 ((calc) (a) = (if (a) < ((10)
          (then) (a) + (a) * (a) + ((a)
          (else) ((a) + (a)) * ((a) + (a))))))
-))
\ No newline at end of file
+)))
\ No newline at end of file
diff --git a/test/src/layout.hs.insert.indent b/test/src/layout.hs.insert.indent
index 18cd6ad..22d0aa6 100644
--- a/test/src/layout.hs.insert.indent
+++ b/test/src/layout.hs.insert.indent
@@ -1,7 +1,7 @@
 -- Figure 2.1 from the Haskell2010 report
 v
 module AStack( Stack, push, pop, top, size ) where
-. v
+v
 data Stack a = Empty
 .            .   v
              | MkStack a (Stack a)
diff --git a/test/src/layout.hs.sexps b/test/src/layout.hs.sexps
index d5a45a1..de8f0a1 100644
--- a/test/src/layout.hs.sexps
+++ b/test/src/layout.hs.sexps
@@ -1,5 +1,5 @@
 -- Figure 2.1 from the Haskell2010 report
-((module) (AStack)( (Stack), (push), (pop), (top), (size) ) (where)
+((module (AStack)( (Stack), (push), (pop), (top), (size) ) (where)
 (((data) (Stack) (a) = (Empty)
              (|) (MkStack) (a) ((Stack) (a))
 
@@ -17,4 +17,4 @@
 
 ((top) (::) (Stack) (a) -> (a))
 ((top) ((MkStack) (x) (s)) = (x)))                     -- top Empty is an error
-))
\ No newline at end of file
+)))
\ No newline at end of file
diff --git a/test/src/medley.hs.insert.indent b/test/src/medley.hs.insert.indent
index 2469ed6..cc4147d 100644
--- a/test/src/medley.hs.insert.indent
+++ b/test/src/medley.hs.insert.indent
@@ -7,7 +7,7 @@ v
 -- | This file is a medley of various constructs and some corner cases
 v
 module Foo.Bar.Main
-. .            v
+. .              v
   ( Wibble(..), Wobble(Wobb, (!!!)), Woo
 . .                                    v
   -- * Operations
@@ -15,11 +15,11 @@ module Foo.Bar.Main
   , getFooByBar, getWibbleByWobble
 . .                v
   , module Bloo.Foo
-. .             v
+. .               v
   ) where
-. v
+v .
 
-. v
+v .
 import           Control.Applicative (many, optional, pure, (<*>), (<|>))
 v
 import           Data.Foldable       (traverse_)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]