@@ -223,6 +223,18 @@ fun = [ f | x ← xs
223
223
(4 10 )
224
224
(5 0 ))
225
225
226
+ (hindent-test " 6b \" let\" in do" "
227
+ fact n = do
228
+ let g = 7
229
+ z <- let x = 5
230
+ in return (x + 4)"
231
+ (1 0 )
232
+ (2 2 )
233
+ (3 2 6 8 )
234
+ (4 7 )
235
+ (5 2 10 ))
236
+
237
+
226
238
(hindent-test " 7a \" data\" after \" data\" " "
227
239
data ABC = ABC
228
240
data DEF = DEF"
@@ -758,6 +770,18 @@ fact n =
758
770
(4 0 2 4 6 )
759
771
(5 0 2 4 6 ))
760
772
773
+ (hindent-test " 46b case expression with guards" "
774
+ fact n = case n of
775
+ n | n == 0 -> 1
776
+ _ | n > 0
777
+ , True == True -> n * fact (n - 1)"
778
+ (1 0 )
779
+ (2 2 )
780
+ ; ; returns (0 2 2 6), to investigate
781
+ (3 0 2 6 )
782
+ (4 4 )
783
+ (5 0 2 6 ))
784
+
761
785
(hindent-test " 47a multiline strings" "
762
786
fact n = \" \\
763
787
\\ a\" "
@@ -777,6 +801,84 @@ fact n = \"\\
777
801
(2 0 9 )
778
802
(3 6 ))
779
803
804
+ (hindent-test " 48 functional dependencies" "
805
+ class X a b | a -> b
806
+ , b -> a where
807
+ fun :: a -> b"
808
+ (1 0 )
809
+ (2 12 )
810
+ (3 2 )
811
+ (4 0 2 9 ))
812
+
813
+ (hindent-test " 49 data with GADT syntax" "
814
+ data Term a where
815
+ Lit :: Int -> Term Int
816
+ Pair :: Term a -> Term b -> Term (a,b)"
817
+ (1 0 )
818
+ (2 2 )
819
+ (3 0 2 9 )
820
+ (4 0 2 10 ))
821
+
822
+ (hindent-test " 49b* data with GADT syntax and a deriving clause" "
823
+ data G [a] b where
824
+ G1 :: c -> G [Int] b
825
+ deriving (Eq)"
826
+ (1 0 )
827
+ (2 2 )
828
+ (3 0 2 ))
829
+
830
+ (hindent-test " 50* standalone deriving" "
831
+ data Name = Name String
832
+ deriving instance Eq Name"
833
+ (1 0 )
834
+ ; ; We accept position 2 here because we have just one
835
+ ; ; look-ahead token so we do not see 'instance'
836
+ ; ; following 'deriving'.
837
+ (2 0 2 ))
838
+
839
+ (hindent-test " 51 standalone deriving" "
840
+ data family T a
841
+ data instance T Int = T1 Int | T2 Bool
842
+ newtype instance T Char = TC Bool"
843
+ ; ; We check that indentation does not bail on 'instance'
844
+ ; ; here, we do not really check if it is working
845
+ ; ; correctly. Needs better test.
846
+ (1 0 )
847
+ (2 0 )
848
+ (3 0 )
849
+ (4 0 2 ))
850
+
851
+ (hindent-test " 52a* module simplest case two lines" "
852
+ module A.B
853
+ where"
854
+ (1 0 )
855
+ (2 0 )
856
+ (3 0 ))
857
+
858
+ (hindent-test " 52b module simplest case one line" "
859
+ module A.B where"
860
+ (1 0 )
861
+ (2 0 ))
862
+
863
+ (hindent-test " 52c* module with exports" "
864
+ module A.B
865
+ ( x
866
+ , y
867
+ )
868
+ where"
869
+ (1 0 )
870
+ (2 2 )
871
+ (3 2 )
872
+ (4 2 )
873
+ (5 0 )
874
+ (6 0 ))
875
+
876
+ (hindent-test " 53 multiway if" "
877
+ fun = if | guard1 -> expr1
878
+ | guardN -> exprN"
879
+ (1 0 )
880
+ (2 9 )
881
+ (3 0 11 ))
780
882
781
883
(defmacro with-temp-switch-to-buffer (&rest body )
782
884
" Create a temporary buffer, use `switch-to-buffer' and evaluate BODY there like `progn' .
0 commit comments