diff options
61 files changed, 962 insertions, 962 deletions
diff --git a/testsuite/tests/ghci.debugger/Test.hs b/testsuite/tests/ghci.debugger/Test.hs index f0477afc3b..0e177a51d9 100644 --- a/testsuite/tests/ghci.debugger/Test.hs +++ b/testsuite/tests/ghci.debugger/Test.hs @@ -1,40 +1,40 @@ -module Test.Test2 where
-import Data.Typeable
-
-data Show1 = S1 Char Char Char
- deriving Typeable
-
-data Strict = S2 Char !Char
-
-data Opaque = forall a. O a
-data List1 a = Nil | a :^ (List1 a)
- deriving Show
-
-newtype MyInt = My Int
- deriving (Eq,Show,Num, Enum)
-
-newtype MkT a = MkT a
- deriving (Show)
-
-newtype MkT2 a = MkT2 (MkT a)
- deriving Show
-
-data Param2 s r = P2 (FakeSTRef r (s(Param2 s r)))
- | P2Nil
-data FakeSTRef r s = Ref s
-
-testParam2 = O (P2 (Ref P2Nil))
-
-infixr 5 :^
---test T{t=t1} = undefined
-
-instance Show Show1 where
- show (S1 a b c) = show (a)
-
-type Just1 = Maybe
-
-
-data Unary = Unary deriving Show
-
-poly :: a -> ()
-poly x = seq x ()
\ No newline at end of file +module Test.Test2 where +import Data.Typeable + +data Show1 = S1 Char Char Char + deriving Typeable + +data Strict = S2 Char !Char + +data Opaque = forall a. O a +data List1 a = Nil | a :^ (List1 a) + deriving Show + +newtype MyInt = My Int + deriving (Eq,Show,Num, Enum) + +newtype MkT a = MkT a + deriving (Show) + +newtype MkT2 a = MkT2 (MkT a) + deriving Show + +data Param2 s r = P2 (FakeSTRef r (s(Param2 s r))) + | P2Nil +data FakeSTRef r s = Ref s + +testParam2 = O (P2 (Ref P2Nil)) + +infixr 5 :^ +--test T{t=t1} = undefined + +instance Show Show1 where + show (S1 a b c) = show (a) + +type Just1 = Maybe + + +data Unary = Unary deriving Show + +poly :: a -> () +poly x = seq x () diff --git a/testsuite/tests/ghci/scripts/ghci019.hs b/testsuite/tests/ghci/scripts/ghci019.hs index f1ea575566..1cb9fef1a2 100644 --- a/testsuite/tests/ghci/scripts/ghci019.hs +++ b/testsuite/tests/ghci/scripts/ghci019.hs @@ -1,9 +1,9 @@ --- Trac #1581
--- Even though Eq is not in scope unqualified, we want to
--- see the Eq instance of Foo when we say :i Foo
-
-module Foo where
-import qualified Prelude
-
-data Foo = Foo
-instance Prelude.Eq Foo
+-- Trac #1581 +-- Even though Eq is not in scope unqualified, we want to +-- see the Eq instance of Foo when we say :i Foo + +module Foo where +import qualified Prelude + +data Foo = Foo +instance Prelude.Eq Foo diff --git a/testsuite/tests/indexed-types/should_compile/ATLoop.hs b/testsuite/tests/indexed-types/should_compile/ATLoop.hs index 19f9e5b8a2..25cd6032bc 100644 --- a/testsuite/tests/indexed-types/should_compile/ATLoop.hs +++ b/testsuite/tests/indexed-types/should_compile/ATLoop.hs @@ -1,22 +1,22 @@ -{-# OPTIONS_GHC -O2 #-}
-
--- Reading the interface file caused a black hole
--- in earlier versions of GHC
-
--- Also, foo should compile to very tight code with -O2
--- (The O2 was nothing to do with the black hole though.)
-
-module ShouldCompile where
-
-import ATLoop_help
-
-foo :: FooT Int -> Int -> Int
-foo t n = t `seq` bar n
- where
- bar 0 = 0
- bar n | even n = bar (n `div` 2)
- bar n = bar (n - int t)
-
-
-
-
+{-# OPTIONS_GHC -O2 #-} + +-- Reading the interface file caused a black hole +-- in earlier versions of GHC + +-- Also, foo should compile to very tight code with -O2 +-- (The O2 was nothing to do with the black hole though.) + +module ShouldCompile where + +import ATLoop_help + +foo :: FooT Int -> Int -> Int +foo t n = t `seq` bar n + where + bar 0 = 0 + bar n | even n = bar (n `div` 2) + bar n = bar (n - int t) + + + + diff --git a/testsuite/tests/indexed-types/should_compile/ATLoop_help.hs b/testsuite/tests/indexed-types/should_compile/ATLoop_help.hs index 8814f480eb..6c366915cd 100644 --- a/testsuite/tests/indexed-types/should_compile/ATLoop_help.hs +++ b/testsuite/tests/indexed-types/should_compile/ATLoop_help.hs @@ -1,10 +1,10 @@ -{-# LANGUAGE TypeFamilies #-}
-module ATLoop_help where
-
-class Foo a where
- data FooT a :: *
- int :: FooT a -> Int
-
-instance Foo Int where
- data FooT Int = FooInt !Int
- int (FooInt n) = n
+{-# LANGUAGE TypeFamilies #-} +module ATLoop_help where + +class Foo a where + data FooT a :: * + int :: FooT a -> Int + +instance Foo Int where + data FooT Int = FooInt !Int + int (FooInt n) = n diff --git a/testsuite/tests/indexed-types/should_compile/CoTest3.hs b/testsuite/tests/indexed-types/should_compile/CoTest3.hs index 971a464a89..d57e58c822 100644 --- a/testsuite/tests/indexed-types/should_compile/CoTest3.hs +++ b/testsuite/tests/indexed-types/should_compile/CoTest3.hs @@ -1,26 +1,26 @@ -{-# LANGUAGE TypeFamilies #-}
-{-# LANGUAGE RankNTypes #-}
-{-# LANGUAGE FlexibleContexts #-}
-{-# LANGUAGE GADTs #-}
-
--- This test uses the PushC rule of the System FC operational semantics
--- Writen by Tom Schrijvers
-
-module CoTest3 where
-
-data T a = K (a ~ Int => a -> Int)
-
-
-{-# INLINE[2] f #-}
-f :: T s1 ~ T s2 => T s1 -> T s2
-f x = x
-
-{-# INLINE[3] test #-}
-test :: T s1 ~ T s2 => (s1 ~ Int => s1 -> Int) -> (s2 ~ Int => s2 -> Int)
-test g = case f (K g) of
- K r -> r
-e :: s ~ Int => s -> s -> Int
-e _ s = s
-
-final :: s1 ~ s2 => s1 -> (s2 ~ Int => s2 -> Int)
-final x = test (e x)
+{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE GADTs #-} + +-- This test uses the PushC rule of the System FC operational semantics +-- Writen by Tom Schrijvers + +module CoTest3 where + +data T a = K (a ~ Int => a -> Int) + + +{-# INLINE[2] f #-} +f :: T s1 ~ T s2 => T s1 -> T s2 +f x = x + +{-# INLINE[3] test #-} +test :: T s1 ~ T s2 => (s1 ~ Int => s1 -> Int) -> (s2 ~ Int => s2 -> Int) +test g = case f (K g) of + K r -> r +e :: s ~ Int => s -> s -> Int +e _ s = s + +final :: s1 ~ s2 => s1 -> (s2 ~ Int => s2 -> Int) +final x = test (e x) diff --git a/testsuite/tests/indexed-types/should_compile/PushedInAsGivens.hs b/testsuite/tests/indexed-types/should_compile/PushedInAsGivens.hs index 063f7021cf..78f45f5f45 100644 --- a/testsuite/tests/indexed-types/should_compile/PushedInAsGivens.hs +++ b/testsuite/tests/indexed-types/should_compile/PushedInAsGivens.hs @@ -1,31 +1,31 @@ -{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, FlexibleContexts, TypeFamilies #-}
-module PushedInAsGivens where
-
-
-type family F a
-
-
-
-bar y = let foo :: (F Int ~ [a]) => a -> Int
- foo x = length [x,y]
- in (y,foo y)
-
-
--- This example demonstrates why we need to push in
--- an unsolved wanted as a given and not a given/solved.
--- [Wanted] F Int ~ [beta]
---- forall a. F Int ~ [a] => a ~ beta
--- We we push in the [Wanted] as given, it will interact and solve the implication
--- constraint, and finally we quantify over F Int ~ [beta]. If we push it in as
--- Given/Solved, it will be discarded when we meet the given (F Int ~ [a]) and
--- we will not be able to solve the implication constraint.
-
--- Oct 14: actually this example is _really_ strange, and doesn't illustrate
--- the real issue in Trac #4935, for which there is a separate test
---
--- The example here requires us to infer a type
--- bar :: F Int ~ [a] => ...
--- which is a strange type to quantify over; better to complain about
--- having no instance for F Int.
-
-
+{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, FlexibleContexts, TypeFamilies #-} +module PushedInAsGivens where + + +type family F a + + + +bar y = let foo :: (F Int ~ [a]) => a -> Int + foo x = length [x,y] + in (y,foo y) + + +-- This example demonstrates why we need to push in +-- an unsolved wanted as a given and not a given/solved. +-- [Wanted] F Int ~ [beta] +--- forall a. F Int ~ [a] => a ~ beta +-- We we push in the [Wanted] as given, it will interact and solve the implication +-- constraint, and finally we quantify over F Int ~ [beta]. If we push it in as +-- Given/Solved, it will be discarded when we meet the given (F Int ~ [a]) and +-- we will not be able to solve the implication constraint. + +-- Oct 14: actually this example is _really_ strange, and doesn't illustrate +-- the real issue in Trac #4935, for which there is a separate test +-- +-- The example here requires us to infer a type +-- bar :: F Int ~ [a] => ... +-- which is a strange type to quantify over; better to complain about +-- having no instance for F Int. + + diff --git a/testsuite/tests/indexed-types/should_compile/T1769.hs b/testsuite/tests/indexed-types/should_compile/T1769.hs index 7a256e1fd8..54b7708a64 100644 --- a/testsuite/tests/indexed-types/should_compile/T1769.hs +++ b/testsuite/tests/indexed-types/should_compile/T1769.hs @@ -1,12 +1,12 @@ -{-# LANGUAGE TypeFamilies, StandaloneDeriving, DeriveDataTypeable, FlexibleInstances #-}
-
-module T1769 where
-
-import Data.Typeable
-
-data family T a
-deriving instance Typeable T
--- deriving instance Functor T
-
-data instance T [b] = T1 | T2 b
-deriving instance Eq b => Eq (T [b])
+{-# LANGUAGE TypeFamilies, StandaloneDeriving, DeriveDataTypeable, FlexibleInstances #-} + +module T1769 where + +import Data.Typeable + +data family T a +deriving instance Typeable T +-- deriving instance Functor T + +data instance T [b] = T1 | T2 b +deriving instance Eq b => Eq (T [b]) diff --git a/testsuite/tests/indexed-types/should_compile/T2850.hs b/testsuite/tests/indexed-types/should_compile/T2850.hs index d284db05db..2c6af5b3b1 100644 --- a/testsuite/tests/indexed-types/should_compile/T2850.hs +++ b/testsuite/tests/indexed-types/should_compile/T2850.hs @@ -1,23 +1,23 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving, TypeFamilies, FlexibleContexts, FlexibleInstances #-}
-
-module T2850 where
-
-class K a where
- bar :: a -> a
-
-class K (B a) => M a where
- data B a :: *
- foo :: B a -> B a
-
-instance M Bool where
- data B Bool = B1Bool Bool | B2Bool Bool
- foo = id
-
-instance K (B Bool) where
- bar = id
-
--- The 'deriving K' gives the (K (B Int)) instance
--- needed for the superclasses of M
-instance M Int where
- newtype B Int = BInt (B Bool) deriving K
- foo = id
+{-# LANGUAGE GeneralizedNewtypeDeriving, TypeFamilies, FlexibleContexts, FlexibleInstances #-} + +module T2850 where + +class K a where + bar :: a -> a + +class K (B a) => M a where + data B a :: * + foo :: B a -> B a + +instance M Bool where + data B Bool = B1Bool Bool | B2Bool Bool + foo = id + +instance K (B Bool) where + bar = id + +-- The 'deriving K' gives the (K (B Int)) instance +-- needed for the superclasses of M +instance M Int where + newtype B Int = BInt (B Bool) deriving K + foo = id diff --git a/testsuite/tests/indexed-types/should_compile/T3423.hs b/testsuite/tests/indexed-types/should_compile/T3423.hs index bbca944374..6cea2036e8 100644 --- a/testsuite/tests/indexed-types/should_compile/T3423.hs +++ b/testsuite/tests/indexed-types/should_compile/T3423.hs @@ -1,12 +1,12 @@ -{-# LANGUAGE TypeFamilies, UndecidableInstances, StandaloneDeriving #-}
-{-# LANGUAGE FlexibleInstances #-}
-
-module T3423 where
-
-newtype Trie m k a = Trie (Maybe a, m (SubKey k) (Trie m k a))
-
-type family SubKey k
-type instance SubKey [k] = k
-
-deriving instance (Eq (m k (Trie m [k] a)), Eq a)
- => Eq (Trie m [k] a)
+{-# LANGUAGE TypeFamilies, UndecidableInstances, StandaloneDeriving #-} +{-# LANGUAGE FlexibleInstances #-} + +module T3423 where + +newtype Trie m k a = Trie (Maybe a, m (SubKey k) (Trie m k a)) + +type family SubKey k +type instance SubKey [k] = k + +deriving instance (Eq (m k (Trie m [k] a)), Eq a) + => Eq (Trie m [k] a) diff --git a/testsuite/tests/indexed-types/should_compile/T3826.hs b/testsuite/tests/indexed-types/should_compile/T3826.hs index 752ba59735..97a474894e 100644 --- a/testsuite/tests/indexed-types/should_compile/T3826.hs +++ b/testsuite/tests/indexed-types/should_compile/T3826.hs @@ -1,61 +1,61 @@ -{-# LANGUAGE TypeFamilies #-}
-
-module T3826 where
-
-class C a where
- type E a
- c :: E a -> a -> a
-
-data T a = MkT a
--- MkT :: a -> T a
-
-instance C (T b) where
- type E (T b) = b
- c x (MkT _) = MkT x
-
-
-f t@(MkT x) = c x t
-
-{- c :: E alpha -> alpha -> alpha
- t :: T beta
- x :: beta
- f :: T beta -> gamma
-
-
- [W] C alpha
- [W] E alpha ~ beta
- [W] alpha ~ T beta
- [W] gamma ~ alpha
-
----> beta = t_aqf alpha = t_aqg
- alpha := T beta
- gamma := alpha
-
- [W] E (T beta) ~ beta
-
--->
- [W] ufsk ~ beta
- [W] E (T beta) ~ ufsk
-
---> (swap and subst)
- beta := ufsk
- [W] x : E (T ufsk) ~ ufsk (do not rewrite RHS)
-
-take a step ax: E (T beta) ~ beta
-
--->
- [W] ufsk
---------------------------
- But what about this?
---------------------------
-
-axiom F [a] = F [a]
-
- x : F [a] ~ fsk
-step
- ax : F [a] ~ F [a]
-flatten
- ax ; x : F [a] ~ fsk
- x = ax ; x Oh dear!
--}
-
+{-# LANGUAGE TypeFamilies #-} + +module T3826 where + +class C a where + type E a + c :: E a -> a -> a + +data T a = MkT a +-- MkT :: a -> T a + +instance C (T b) where + type E (T b) = b + c x (MkT _) = MkT x + + +f t@(MkT x) = c x t + +{- c :: E alpha -> alpha -> alpha + t :: T beta + x :: beta + f :: T beta -> gamma + + + [W] C alpha + [W] E alpha ~ beta + [W] alpha ~ T beta + [W] gamma ~ alpha + +---> beta = t_aqf alpha = t_aqg + alpha := T beta + gamma := alpha + + [W] E (T beta) ~ beta + +--> + [W] ufsk ~ beta + [W] E (T beta) ~ ufsk + +--> (swap and subst) + beta := ufsk + [W] x : E (T ufsk) ~ ufsk (do not rewrite RHS) + +take a step ax: E (T beta) ~ beta + +--> + [W] ufsk +-------------------------- + But what about this? +-------------------------- + +axiom F [a] = F [a] + + x : F [a] ~ fsk +step + ax : F [a] ~ F [a] +flatten + ax ; x : F [a] ~ fsk + x = ax ; x Oh dear! +-} + diff --git a/testsuite/tests/indexed-types/should_compile/T3851.hs b/testsuite/tests/indexed-types/should_compile/T3851.hs index 3b40db1bce..7c2f252c7f 100644 --- a/testsuite/tests/indexed-types/should_compile/T3851.hs +++ b/testsuite/tests/indexed-types/should_compile/T3851.hs @@ -1,24 +1,24 @@ -{-# LANGUAGE GADTs, TypeFamilies #-}
-
-module T3851 where
-
-type family TF a :: * -> *
-type instance TF () = App (Equ ())
-
-data Equ ix ix' where Refl :: Equ ix ix
-data App f x = App (f x)
-
--- does not typecheck in 6.12.1 (but works in 6.10.4)
-bar :: TF () () -> ()
-bar (App Refl) = ()
-
--- does typecheck in 6.12.1 and 6.10.4
-ar :: App (Equ ()) () -> ()
-ar (App Refl) = ()
-
-------------------
-data family DF a :: * -> *
-data instance DF () a = D (App (Equ ()) a)
-
-bar_df :: DF () () -> ()
-bar_df (D (App Refl)) = ()
+{-# LANGUAGE GADTs, TypeFamilies #-} + +module T3851 where + +type family TF a :: * -> * +type instance TF () = App (Equ ()) + +data Equ ix ix' where Refl :: Equ ix ix +data App f x = App (f x) + +-- does not typecheck in 6.12.1 (but works in 6.10.4) +bar :: TF () () -> () +bar (App Refl) = () + +-- does typecheck in 6.12.1 and 6.10.4 +ar :: App (Equ ()) () -> () +ar (App Refl) = () + +------------------ +data family DF a :: * -> * +data instance DF () a = D (App (Equ ()) a) + +bar_df :: DF () () -> () +bar_df (D (App Refl)) = () diff --git a/testsuite/tests/indexed-types/should_compile/T4185.hs b/testsuite/tests/indexed-types/should_compile/T4185.hs index 6a1be25bc6..d7fdbd52f3 100644 --- a/testsuite/tests/indexed-types/should_compile/T4185.hs +++ b/testsuite/tests/indexed-types/should_compile/T4185.hs @@ -1,46 +1,46 @@ -{-# LANGUAGE DeriveFunctor, StandaloneDeriving, FlexibleInstances, TypeFamilies, GeneralizedNewtypeDeriving #-}
-module T4185 where
-
-data family Foo k :: * -> *
-
-------------- Generalised newtype deriving of user class -----------
-class Bar f where
- bar :: f a -> Int
- woo :: f a -> f a
-
-instance Bar Maybe where
- bar Nothing = 0
- bar Just{} = 1
- woo x = x
-
--- Deriving clause
-newtype instance Foo Int a = FooInt (Maybe a) deriving (Bar)
-
--- Standalone deriving
-newtype instance Foo Char a = FooChar (Maybe a)
-deriving instance Bar (Foo Char)
-
-{-
-dBarMaybe :: Bar Maybe
-
-newtype FooInt a = FooInt (Maybe a)
-axiom ax7 a : Foo Int a ~ FooInt a -- Family axiom
-axiom ax7 : FooInt ~ Maybe -- Newtype axiom
-
-dBarFooInt :: Bar (Foo Int)
-dBarFooInt = dBarMaybe |> Bar ax7
--}
-
-------------- Deriving on data types for Functor -----------
-
--- Deriving clause
-data instance Foo Bool a = FB1 a | FB2 a deriving( Functor )
-
--- Standalone deriving
-data instance Foo Float a = FB3 a
-deriving instance Functor (Foo Float)
-
-
---instance Functor (Foo Bool) where
--- fmap f (FB1 x) = FB1 (f x)
--- fmap f (FB2 y) = FB2 (f y)
\ No newline at end of file +{-# LANGUAGE DeriveFunctor, StandaloneDeriving, FlexibleInstances, TypeFamilies, GeneralizedNewtypeDeriving #-} +module T4185 where + +data family Foo k :: * -> * + +------------- Generalised newtype deriving of user class ----------- +class Bar f where + bar :: f a -> Int + woo :: f a -> f a + +instance Bar Maybe where + bar Nothing = 0 + bar Just{} = 1 + woo x = x + +-- Deriving clause +newtype instance Foo Int a = FooInt (Maybe a) deriving (Bar) + +-- Standalone deriving +newtype instance Foo Char a = FooChar (Maybe a) +deriving instance Bar (Foo Char) + +{- +dBarMaybe :: Bar Maybe + +newtype FooInt a = FooInt (Maybe a) +axiom ax7 a : Foo Int a ~ FooInt a -- Family axiom +axiom ax7 : FooInt ~ Maybe -- Newtype axiom + +dBarFooInt :: Bar (Foo Int) +dBarFooInt = dBarMaybe |> Bar ax7 +-} + +------------- Deriving on data types for Functor ----------- + +-- Deriving clause +data instance Foo Bool a = FB1 a | FB2 a deriving( Functor ) + +-- Standalone deriving +data instance Foo Float a = FB3 a +deriving instance Functor (Foo Float) + + +--instance Functor (Foo Bool) where +-- fmap f (FB1 x) = FB1 (f x) +-- fmap f (FB2 y) = FB2 (f y) diff --git a/testsuite/tests/indexed-types/should_compile/TF_GADT.hs b/testsuite/tests/indexed-types/should_compile/TF_GADT.hs index 345b5748e0..cdb397c603 100644 --- a/testsuite/tests/indexed-types/should_compile/TF_GADT.hs +++ b/testsuite/tests/indexed-types/should_compile/TF_GADT.hs @@ -1,21 +1,21 @@ -{-# LANGUAGE GADTs, TypeFamilies #-}
-
-module TF_GADT where
-
--- Check that type families can be declared in GADT syntax
--- and indeed *be* GADTs
-
-data family T a
-
-data instance T [a] where
- T1 :: a -> T [a]
-
-
-data instance T (Maybe a) where
- T3 :: Int -> T (Maybe Int)
- T4 :: a -> b -> T (Maybe (a,b))
-
-
-f :: a -> T (Maybe a) -> T (Maybe a)
-f x (T3 i) = T3 x
-f x (T4 p q) = T4 p (snd x)
+{-# LANGUAGE GADTs, TypeFamilies #-} + +module TF_GADT where + +-- Check that type families can be declared in GADT syntax +-- and indeed *be* GADTs + +data family T a + +data instance T [a] where + T1 :: a -> T [a] + + +data instance T (Maybe a) where + T3 :: Int -> T (Maybe Int) + T4 :: a -> b -> T (Maybe (a,b)) + + +f :: a -> T (Maybe a) -> T (Maybe a) +f x (T3 i) = T3 x +f x (T4 p q) = T4 p (snd x) diff --git a/testsuite/tests/indexed-types/should_fail/DerivUnsatFam.hs b/testsuite/tests/indexed-types/should_fail/DerivUnsatFam.hs index d401356326..fabd785977 100644 --- a/testsuite/tests/indexed-types/should_fail/DerivUnsatFam.hs +++ b/testsuite/tests/indexed-types/should_fail/DerivUnsatFam.hs @@ -1,8 +1,8 @@ -{-# LANGUAGE TypeFamilies, StandaloneDeriving #-}
-
--- Crashed 6.12
-
-module T1769 where
-
-data family T a
-deriving instance Functor T
+{-# LANGUAGE TypeFamilies, StandaloneDeriving #-} + +-- Crashed 6.12 + +module T1769 where + +data family T a +deriving instance Functor T diff --git a/testsuite/tests/indexed-types/should_fail/T2544.hs b/testsuite/tests/indexed-types/should_fail/T2544.hs index 0e98910055..2150cd5775 100644 --- a/testsuite/tests/indexed-types/should_fail/T2544.hs +++ b/testsuite/tests/indexed-types/should_fail/T2544.hs @@ -1,30 +1,30 @@ -{-# LANGUAGE TypeOperators, TypeFamilies #-}
-{-# LANGUAGE AllowAmbiguousTypes #-}
- -- The type of 'empty' is indeed ambiguous
-
-module T2544 where
-
-data (:|:) a b = Inl a | Inr b
-
-class Ix i where
- type IxMap i :: * -> *
- empty :: IxMap i [Int]
-
-data BiApp a b c = BiApp (a c) (b c)
-
-instance (Ix l, Ix r) => Ix (l :|: r) where
- type IxMap (l :|: r) = BiApp (IxMap l) (IxMap r)
- empty = BiApp empty empty
-
--- [W] w1: a c ~ IxMap ii1 [Int] (from first 'empty')
--- [W] w2: b c ~ IxMap ii2 [Int] (from second 'empty')
--- [W] w3: BiApp a b c ~ IxMap (l :|: r) [Int] (from call of BiApp
--- ~ BiApp (IxMap l) (IxMap r) [Int]
-
--- If we process w3 first, we'll rewrite it with w1, w2
--- yielding two constraints (Ix io ~ IxMap l, Ix i1 ~ IxMap r)
--- both with location of w3. Then we report just one of them,
--- because we suppress multiple errors from the same location
---
--- But if we process w1,w2 first, we'll get the same constraints
--- but this time with different locations.
+{-# LANGUAGE TypeOperators, TypeFamilies #-} +{-# LANGUAGE AllowAmbiguousTypes #-} + -- The type of 'empty' is indeed ambiguous + +module T2544 where + +data (:|:) a b = Inl a | Inr b + +class Ix i where + type IxMap i :: * -> * + empty :: IxMap i [Int] + +data BiApp a b c = BiApp (a c) (b c) + +instance (Ix l, Ix r) => Ix (l :|: r) where + type IxMap (l :|: r) = BiApp (IxMap l) (IxMap r) + empty = BiApp empty empty + +-- [W] w1: a c ~ IxMap ii1 [Int] (from first 'empty') +-- [W] w2: b c ~ IxMap ii2 [Int] (from second 'empty') +-- [W] w3: BiApp a b c ~ IxMap (l :|: r) [Int] (from call of BiApp +-- ~ BiApp (IxMap l) (IxMap r) [Int] + +-- If we process w3 first, we'll rewrite it with w1, w2 +-- yielding two constraints (Ix io ~ IxMap l, Ix i1 ~ IxMap r) +-- both with location of w3. Then we report just one of them, +-- because we suppress multiple errors from the same location +-- +-- But if we process w1,w2 first, we'll get the same constraints +-- but this time with different locations. diff --git a/testsuite/tests/indexed-types/should_fail/T4093b.hs b/testsuite/tests/indexed-types/should_fail/T4093b.hs index 2d9878541f..2d1275634e 100644 --- a/testsuite/tests/indexed-types/should_fail/T4093b.hs +++ b/testsuite/tests/indexed-types/should_fail/T4093b.hs @@ -1,40 +1,40 @@ -{-# LANGUAGE GADTs, EmptyDataDecls, ScopedTypeVariables, TypeFamilies #-}
-
-module T4093b where
-
-data C
-data O
-
-type family EitherCO e a b :: *
-type instance EitherCO C a b = a
-type instance EitherCO O a b = b
-
-data MaybeC ex t where
- JustC :: t -> MaybeC C t
- NothingC :: MaybeC O t
-
-data Block (n :: * -> * -> *) e x
-
-
-blockToNodeList ::
- forall n e x. (EitherCO e (A C O n) (A O O n) ~ A e O n,
- EitherCO x (A C C n) (A C O n) ~ A C x n) =>
- Block n e x -> A e x n
-
-type A e x n = (MaybeC e (n C O), MaybeC x (n O C))
-blockToNodeList b = foldBlockNodesF (f, l) b z
- where
- z :: EitherCO e (EitherCO e (A C O n) (A O O n)) (EitherCO e (A C O n) (A O O n))
- z = undefined
-
- f :: n C O -> EitherCO e (A C O n) (A O O n) -> EitherCO e (A C O n) (A O O n)
- f n _ = (JustC n, NothingC)
-
- l :: n O C -> EitherCO e (A C O n) (A O O n) -> EitherCO e (A C C n) (A O C n)
- l _ = undefined
-
-foldBlockNodesF :: forall n a b c e x .
- ( n C O -> a -> b
- , n O C -> b -> c)
- -> (Block n e x -> EitherCO e a b -> EitherCO x c b)
-foldBlockNodesF _ = undefined
+{-# LANGUAGE GADTs, EmptyDataDecls, ScopedTypeVariables, TypeFamilies #-} + +module T4093b where + +data C +data O + +type family EitherCO e a b :: * +type instance EitherCO C a b = a +type instance EitherCO O a b = b + +data MaybeC ex t where + JustC :: t -> MaybeC C t + NothingC :: MaybeC O t + +data Block (n :: * -> * -> *) e x + + +blockToNodeList :: + forall n e x. (EitherCO e (A C O n) (A O O n) ~ A e O n, + EitherCO x (A C C n) (A C O n) ~ A C x n) => + Block n e x -> A e x n + +type A e x n = (MaybeC e (n C O), MaybeC x (n O C)) +blockToNodeList b = foldBlockNodesF (f, l) b z + where + z :: EitherCO e (EitherCO e (A C O n) (A O O n)) (EitherCO e (A C O n) (A O O n)) + z = undefined + + f :: n C O -> EitherCO e (A C O n) (A O O n) -> EitherCO e (A C O n) (A O O n) + f n _ = (JustC n, NothingC) + + l :: n O C -> EitherCO e (A C O n) (A O O n) -> EitherCO e (A C C n) (A O C n) + l _ = undefined + +foldBlockNodesF :: forall n a b c e x . + ( n C O -> a -> b + , n O C -> b -> c) + -> (Block n e x -> EitherCO e a b -> EitherCO x c b) +foldBlockNodesF _ = undefined diff --git a/testsuite/tests/indexed-types/should_fail/T4246.hs b/testsuite/tests/indexed-types/should_fail/T4246.hs index 60b56405ad..ad280583ab 100644 --- a/testsuite/tests/indexed-types/should_fail/T4246.hs +++ b/testsuite/tests/indexed-types/should_fail/T4246.hs @@ -1,15 +1,15 @@ -{-# LANGUAGE TypeFamilies, FlexibleInstances #-}
-module T4246 where
-
-class Stupid a where
- type F a
-
-instance {-# OVERLAPPABLE #-} Stupid a where
- type F a = a
-
-instance {-# OVERLAPPING #-} Stupid Int where
- type F Int = Bool
-
-type family G a :: *
-type instance G Int = Int
-type instance G Int = Bool
+{-# LANGUAGE TypeFamilies, FlexibleInstances #-} +module T4246 where + +class Stupid a where + type F a + +instance {-# OVERLAPPABLE #-} Stupid a where + type F a = a + +instance {-# OVERLAPPING #-} Stupid Int where + type F Int = Bool + +type family G a :: * +type instance G Int = Int +type instance G Int = Bool diff --git a/testsuite/tests/mdo/should_fail/mdofail006.hs b/testsuite/tests/mdo/should_fail/mdofail006.hs index c904c2c6b2..6896ecfd3d 100644 --- a/testsuite/tests/mdo/should_fail/mdofail006.hs +++ b/testsuite/tests/mdo/should_fail/mdofail006.hs @@ -1,12 +1,12 @@ -{-# LANGUAGE DoRec #-}
-
--- check that do-rec does not perform segmentation
-t :: IO [Int]
-t = do rec xs <- return (1:xs)
- print (length (take 10 xs)) -- would diverge without segmentation
- return (take 10 xs)
-
--- should diverge when run
--- currently it exhibits itself via a blocked MVar operation
-main :: IO ()
-main = t >>= print
+{-# LANGUAGE DoRec #-} + +-- check that do-rec does not perform segmentation +t :: IO [Int] +t = do rec xs <- return (1:xs) + print (length (take 10 xs)) -- would diverge without segmentation + return (take 10 xs) + +-- should diverge when run +-- currently it exhibits itself via a blocked MVar operation +main :: IO () +main = t >>= print diff --git a/testsuite/tests/mdo/should_run/mdorun003.hs b/testsuite/tests/mdo/should_run/mdorun003.hs index f818afa56a..45b78f601f 100644 --- a/testsuite/tests/mdo/should_run/mdorun003.hs +++ b/testsuite/tests/mdo/should_run/mdorun003.hs @@ -1,8 +1,8 @@ -{-# LANGUAGE DoRec #-}
-
-main :: IO ()
-main = do x <- return (length [1 .. 42 :: Int])
- rec b <- return x
- let a = const c
- c <- print "x"
- print (b, a b)
+{-# LANGUAGE DoRec #-} + +main :: IO () +main = do x <- return (length [1 .. 42 :: Int]) + rec b <- return x + let a = const c + c <- print "x" + print (b, a b) diff --git a/testsuite/tests/mdo/should_run/mdorun004.hs b/testsuite/tests/mdo/should_run/mdorun004.hs index eee0be98ea..88ed4e7c0c 100644 --- a/testsuite/tests/mdo/should_run/mdorun004.hs +++ b/testsuite/tests/mdo/should_run/mdorun004.hs @@ -1,10 +1,10 @@ -{-# LANGUAGE RecursiveDo #-}
-
--- check that mdo does perform segmentation
-t :: IO [Int]
-t = mdo xs <- return (1:xs)
- print (length (take 10 xs)) -- would diverge without segmentation
- return (take 10 xs)
-
-main :: IO ()
-main = t >>= print
+{-# LANGUAGE RecursiveDo #-} + +-- check that mdo does perform segmentation +t :: IO [Int] +t = mdo xs <- return (1:xs) + print (length (take 10 xs)) -- would diverge without segmentation + return (take 10 xs) + +main :: IO () +main = t >>= print diff --git a/testsuite/tests/mdo/should_run/mdorun005.hs b/testsuite/tests/mdo/should_run/mdorun005.hs index f9e2de23f2..1c4ff2766e 100644 --- a/testsuite/tests/mdo/should_run/mdorun005.hs +++ b/testsuite/tests/mdo/should_run/mdorun005.hs @@ -1,11 +1,11 @@ -{-# LANGUAGE DoRec #-}
-
--- check that do-rec does not perform segmentation
--- compare with ../should_fail/mdofail006.hs
-t :: IO [Int]
-t = do rec xs <- return (1:xs)
- print (length (take 10 xs)) -- would work since out of the segment
- return (take 10 xs)
-
-main :: IO ()
-main = t >>= print
+{-# LANGUAGE DoRec #-} + +-- check that do-rec does not perform segmentation +-- compare with ../should_fail/mdofail006.hs +t :: IO [Int] +t = do rec xs <- return (1:xs) + print (length (take 10 xs)) -- would work since out of the segment + return (take 10 xs) + +main :: IO () +main = t >>= print diff --git a/testsuite/tests/module/T1074.hs b/testsuite/tests/module/T1074.hs index 6cd647ba6d..75a07c13f4 100644 --- a/testsuite/tests/module/T1074.hs +++ b/testsuite/tests/module/T1074.hs @@ -1,8 +1,8 @@ -{-# OPTIONS_GHC -fwarn-unused-imports #-}
-module Test where
-
-import qualified Control.Monad (ap)
-import qualified Control.Monad.Reader
-
-foo :: IO ()
-foo = return id `Control.Monad.ap` return ()
+{-# OPTIONS_GHC -fwarn-unused-imports #-} +module Test where + +import qualified Control.Monad (ap) +import qualified Control.Monad.Reader + +foo :: IO () +foo = return id `Control.Monad.ap` return () diff --git a/testsuite/tests/module/T1074a.hs b/testsuite/tests/module/T1074a.hs index 0fcbdf600f..1fb6f7108c 100644 --- a/testsuite/tests/module/T1074a.hs +++ b/testsuite/tests/module/T1074a.hs @@ -1,28 +1,28 @@ -{-# OPTIONS_GHC -fwarn-unused-imports #-}
-
-module Test where
-
-import qualified System.FilePath as FilePath.Native
- ( joinPath )
-import qualified System.FilePath.Posix as FilePath.Posix
- ( joinPath, splitDirectories )
-import qualified System.FilePath.Windows as FilePath.Windows
- ( joinPath )
-
-data TarPath = TarPath FilePath -- path name, 100 characters max.
- FilePath -- path prefix, 155 characters max.
-
-fromTarPath, fromTarPathToPosixPath
- , fromTarPathToWindowsPath :: TarPath -> FilePath
-
-fromTarPath (TarPath name prefix) =
- FilePath.Native.joinPath $ FilePath.Posix.splitDirectories prefix
- ++ FilePath.Posix.splitDirectories name
-
-fromTarPathToPosixPath (TarPath name prefix) =
- FilePath.Posix.joinPath $ FilePath.Posix.splitDirectories prefix
- ++ FilePath.Posix.splitDirectories name
-
-fromTarPathToWindowsPath (TarPath name prefix) =
- FilePath.Windows.joinPath $ FilePath.Posix.splitDirectories prefix
- ++ FilePath.Posix.splitDirectories name
+{-# OPTIONS_GHC -fwarn-unused-imports #-} + +module Test where + +import qualified System.FilePath as FilePath.Native + ( joinPath ) +import qualified System.FilePath.Posix as FilePath.Posix + ( joinPath, splitDirectories ) +import qualified System.FilePath.Windows as FilePath.Windows + ( joinPath ) + +data TarPath = TarPath FilePath -- path name, 100 characters max. + FilePath -- path prefix, 155 characters max. + +fromTarPath, fromTarPathToPosixPath + , fromTarPathToWindowsPath :: TarPath -> FilePath + +fromTarPath (TarPath name prefix) = + FilePath.Native.joinPath $ FilePath.Posix.splitDirectories prefix + ++ FilePath.Posix.splitDirectories name + +fromTarPathToPosixPath (TarPath name prefix) = + FilePath.Posix.joinPath $ FilePath.Posix.splitDirectories prefix + ++ FilePath.Posix.splitDirectories name + +fromTarPathToWindowsPath (TarPath name prefix) = + FilePath.Windows.joinPath $ FilePath.Posix.splitDirectories prefix + ++ FilePath.Posix.splitDirectories name diff --git a/testsuite/tests/module/T1148.hs b/testsuite/tests/module/T1148.hs index c6758e580b..11dc838916 100644 --- a/testsuite/tests/module/T1148.hs +++ b/testsuite/tests/module/T1148.hs @@ -1,19 +1,19 @@ -{-# OPTIONS_GHC -XFlexibleContexts -fwarn-unused-imports #-}
-
-module ArrayBoundedU
- ( T
- , create
- , at
- ) where
-
-import Data.Ix
-import qualified Data.Array.Unboxed as Array
-import Data.Array.Base (unsafeAt)
-
-newtype T i e = T (Array.UArray i e)
-
-create :: (Ix i, Bounded i, Array.IArray Array.UArray e) => [(i,e)] -> T i e
-create ies = T (Array.array (minBound, maxBound) ies)
-
-at :: (Ix i, Bounded i, Array.IArray Array.UArray e) => T i e -> i -> e
-at (T a) i = unsafeAt a (index (minBound, maxBound) i)
+{-# OPTIONS_GHC -XFlexibleContexts -fwarn-unused-imports #-} + +module ArrayBoundedU + ( T + , create + , at + ) where + +import Data.Ix +import qualified Data.Array.Unboxed as Array +import Data.Array.Base (unsafeAt) + +newtype T i e = T (Array.UArray i e) + +create :: (Ix i, Bounded i, Array.IArray Array.UArray e) => [(i,e)] -> T i e +create ies = T (Array.array (minBound, maxBound) ies) + +at :: (Ix i, Bounded i, Array.IArray Array.UArray e) => T i e -> i -> e +at (T a) i = unsafeAt a (index (minBound, maxBound) i) diff --git a/testsuite/tests/module/T2267.hs b/testsuite/tests/module/T2267.hs index 851997cd9d..04731fb14e 100644 --- a/testsuite/tests/module/T2267.hs +++ b/testsuite/tests/module/T2267.hs @@ -1,12 +1,12 @@ -{-# OPTIONS_GHC -fwarn-unused-imports -Werror #-}
-
-module T2267 where
-
-import qualified Data.ByteString as B
-import qualified Data.ByteString.UTF8 as BU
-
-toString :: B.ByteString -> String
-toString = BU.toString
-
-fromString :: String -> B.ByteString
-fromString = BU.fromString
+{-# OPTIONS_GHC -fwarn-unused-imports -Werror #-} + +module T2267 where + +import qualified Data.ByteString as B +import qualified Data.ByteString.UTF8 as BU + +toString :: B.ByteString -> String +toString = BU.toString + +fromString :: String -> B.ByteString +fromString = BU.fromString diff --git a/testsuite/tests/parser/should_compile/read062.hs b/testsuite/tests/parser/should_compile/read062.hs index d324111de5..3d816a28e2 100644 --- a/testsuite/tests/parser/should_compile/read062.hs +++ b/testsuite/tests/parser/should_compile/read062.hs @@ -1,16 +1,16 @@ -{-# OPTIONS_GHC -XTransformListComp #-}
-
-module Foo where
-
-import Data.List
-import GHC.Exts
-
-foo = [ ()
- | x <- [1..10]
- , then take 5
- , then sortWith by x
- , then group by x using groupWith
- , then group using inits
- , then group by x using groupWith
- ]
-
+{-# OPTIONS_GHC -XTransformListComp #-} + +module Foo where + +import Data.List +import GHC.Exts + +foo = [ () + | x <- [1..10] + , then take 5 + , then sortWith by x + , then group by x using groupWith + , then group using inits + , then group by x using groupWith + ] + diff --git a/testsuite/tests/parser/should_fail/readFail031.hs b/testsuite/tests/parser/should_fail/readFail031.hs index d07f8979a6..979d3ceda0 100644 --- a/testsuite/tests/parser/should_fail/readFail031.hs +++ b/testsuite/tests/parser/should_fail/readFail031.hs @@ -1,4 +1,4 @@ -module ShouldFail where
-
-class Foo o where
- (:+) :: o -> o -> o
+module ShouldFail where + +class Foo o where + (:+) :: o -> o -> o diff --git a/testsuite/tests/parser/should_fail/readFail042.hs b/testsuite/tests/parser/should_fail/readFail042.hs index bdd9f97094..7849e7f023 100644 --- a/testsuite/tests/parser/should_fail/readFail042.hs +++ b/testsuite/tests/parser/should_fail/readFail042.hs @@ -1,12 +1,12 @@ --- Check error message for transforms if we don't have the right extension turned on
-
-module Foo where
-
-import Data.List
-import GHC.Exts
-
-foo = [ ()
- | x <- [1..10]
- , then take 5
- , then sortWith by x
- ]
\ No newline at end of file +-- Check error message for transforms if we don't have the right extension turned on + +module Foo where + +import Data.List +import GHC.Exts + +foo = [ () + | x <- [1..10] + , then take 5 + , then sortWith by x + ] diff --git a/testsuite/tests/parser/should_fail/readFail043.hs b/testsuite/tests/parser/should_fail/readFail043.hs index 65e00b36bd..c88e44baa7 100644 --- a/testsuite/tests/parser/should_fail/readFail043.hs +++ b/testsuite/tests/parser/should_fail/readFail043.hs @@ -1,14 +1,14 @@ --- Check error message for groups if we don't have the right extension turned on
-
-module Foo where
-
-import Data.List
-import GHC.Exts
-
-foo = [ ()
- | x <- [1..10]
- , then group by x using groupWith
- , then group by x using groupWith
- , then group using inits
- ]
-
+-- Check error message for groups if we don't have the right extension turned on + +module Foo where + +import Data.List +import GHC.Exts + +foo = [ () + | x <- [1..10] + , then group by x using groupWith + , then group by x using groupWith + , then group using inits + ] + diff --git a/testsuite/tests/parser/unicode/T1744.hs b/testsuite/tests/parser/unicode/T1744.hs index 90273741da..5fd6687b13 100644 --- a/testsuite/tests/parser/unicode/T1744.hs +++ b/testsuite/tests/parser/unicode/T1744.hs @@ -1,3 +1,3 @@ -main = print hello
--- test that layout has not been screwed up
-hello = "こんにちは 世界"
+main = print hello +-- test that layout has not been screwed up +hello = "こんにちは 世界" diff --git a/testsuite/tests/polykinds/T5862.hs b/testsuite/tests/polykinds/T5862.hs index 4626245de6..7376271865 100644 --- a/testsuite/tests/polykinds/T5862.hs +++ b/testsuite/tests/polykinds/T5862.hs @@ -1,27 +1,27 @@ -{-# LANGUAGE PolyKinds,
- TypeFamilies,
- GADTs,
- DataKinds,
- KindSignatures
- #-}
-
-module T5862 where
-
-data Nat = Zero | Succ Nat
-
-data SNat a where
- SZero :: SNat 'Zero
- SSucc :: SNat n -> SNat ('Succ n)
-
-data SBool a where
- SFalse :: SBool 'False
- STrue :: SBool 'True
-
-data SMaybe a where
- SNothing :: SMaybe 'Nothing
- SJust :: Sing a -> SMaybe ('Just a)
-
-type family Sing (a :: k)
-type instance Sing (a :: Nat) = SNat a
-type instance Sing (a :: Bool) = SBool a
-type instance Sing (a :: Maybe *) = SMaybe a -- want to say Maybe k
+{-# LANGUAGE PolyKinds, + TypeFamilies, + GADTs, + DataKinds, + KindSignatures + #-} + +module T5862 where + +data Nat = Zero | Succ Nat + +data SNat a where + SZero :: SNat 'Zero + SSucc :: SNat n -> SNat ('Succ n) + +data SBool a where + SFalse :: SBool 'False + STrue :: SBool 'True + +data SMaybe a where + SNothing :: SMaybe 'Nothing + SJust :: Sing a -> SMaybe ('Just a) + +type family Sing (a :: k) +type instance Sing (a :: Nat) = SNat a +type instance Sing (a :: Bool) = SBool a +type instance Sing (a :: Maybe *) = SMaybe a -- want to say Maybe k diff --git a/testsuite/tests/polykinds/T5912.hs b/testsuite/tests/polykinds/T5912.hs index 33c41950ca..b44bda2ba6 100644 --- a/testsuite/tests/polykinds/T5912.hs +++ b/testsuite/tests/polykinds/T5912.hs @@ -1,12 +1,12 @@ -{-# LANGUAGE DataKinds #-}
-
--- This bug related to type trimming, and
--- hence showed up only with -O0
-
-module Bug() where
-
-data UnaryTypeC a = UnaryDataC a
-
-type Bug = 'UnaryDataC
-
-
+{-# LANGUAGE DataKinds #-} + +-- This bug related to type trimming, and +-- hence showed up only with -O0 + +module Bug() where + +data UnaryTypeC a = UnaryDataC a + +type Bug = 'UnaryDataC + + diff --git a/testsuite/tests/polykinds/T6020.hs b/testsuite/tests/polykinds/T6020.hs index a044efe380..895de1f953 100644 --- a/testsuite/tests/polykinds/T6020.hs +++ b/testsuite/tests/polykinds/T6020.hs @@ -1,21 +1,21 @@ -{-# LANGUAGE DataKinds, FunctionalDependencies, FlexibleInstances,
- UndecidableInstances, PolyKinds, KindSignatures,
- ConstraintKinds, FlexibleContexts #-}
-
-module T6020 where
-
-class Id (a :: k) (b :: k) | a -> b
-instance Id a a
-
-f :: Id x y => x -> y
-f = f
-
---class Test (x :: a) (y :: a) | x -> y
---instance (Id x y, Id y z) => Test x z
-
--- (Id x0 y0, Id y0 z0, x~x0, z~z0)
--- (Id x y0, Id y0 z, y0~z, y0~y)
-
---test :: Test True True => ()
---test = ()
-
+{-# LANGUAGE DataKinds, FunctionalDependencies, FlexibleInstances, + UndecidableInstances, PolyKinds, KindSignatures, + ConstraintKinds, FlexibleContexts #-} + +module T6020 where + +class Id (a :: k) (b :: k) | a -> b +instance Id a a + +f :: Id x y => x -> y +f = f + +--class Test (x :: a) (y :: a) | x -> y +--instance (Id x y, Id y z) => Test x z + +-- (Id x0 y0, Id y0 z0, x~x0, z~z0) +-- (Id x y0, Id y0 z, y0~z, y0~y) + +--test :: Test True True => () +--test = () + diff --git a/testsuite/tests/polykinds/T6035.hs b/testsuite/tests/polykinds/T6035.hs index c9e4342d08..a6f5ffe54a 100644 --- a/testsuite/tests/polykinds/T6035.hs +++ b/testsuite/tests/polykinds/T6035.hs @@ -1,28 +1,28 @@ -{-# LANGUAGE PolyKinds, DataKinds, TypeFamilies, KindSignatures, GADTs, TypeOperators
- #-}
-
-module T6035 where
-
-data Nat = Zero | Succ Nat
-
-type family Sing (a :: k) :: k -> *
-
-data SNat n where
- SZero :: SNat Zero
- SSucc :: SNat n -> SNat (Succ n)
-
-data SList (a :: [k]) where
- SNil :: SList '[]
- SCons :: Sing h h -> SList t -> SList (h ': t)
-
-type instance Sing (a :: Nat) = SNat
-type instance Sing (a :: [k]) = SList
-
-nil :: SList '[]
-nil = SNil
-
-zero :: SList '[ '[] ]
-zero = SCons SNil SNil
-
-term :: SList '[ '[Zero], '[]]
-term = SCons (SCons SZero SNil) (SCons SNil SNil)
+{-# LANGUAGE PolyKinds, DataKinds, TypeFamilies, KindSignatures, GADTs, TypeOperators + #-} + +module T6035 where + +data Nat = Zero | Succ Nat + +type family Sing (a :: k) :: k -> * + +data SNat n where + SZero :: SNat Zero + SSucc :: SNat n -> SNat (Succ n) + +data SList (a :: [k]) where + SNil :: SList '[] + SCons :: Sing h h -> SList t -> SList (h ': t) + +type instance Sing (a :: Nat) = SNat +type instance Sing (a :: [k]) = SList + +nil :: SList '[] +nil = SNil + +zero :: SList '[ '[] ] +zero = SCons SNil SNil + +term :: SList '[ '[Zero], '[]] +term = SCons (SCons SZero SNil) (SCons SNil SNil) diff --git a/testsuite/tests/polykinds/T6036.hs b/testsuite/tests/polykinds/T6036.hs index 4425c85cd5..c64f4899b4 100644 --- a/testsuite/tests/polykinds/T6036.hs +++ b/testsuite/tests/polykinds/T6036.hs @@ -1,17 +1,17 @@ -{-# LANGUAGE DataKinds, TypeFamilies, PolyKinds, GADTs #-}
-
-module T6036 where
-
-data family Sing (a :: k)
-
-data instance Sing (a :: Maybe k) where
- SNothing :: Sing 'Nothing
- SJust :: Sing b -> Sing ('Just b)
-
-data Nat = Zero | Succ Nat
-
-data instance Sing (a :: Nat) where
- SZero :: Sing Zero
- SSucc :: Sing n -> Sing (Succ n)
-
-term = SJust SZero
+{-# LANGUAGE DataKinds, TypeFamilies, PolyKinds, GADTs #-} + +module T6036 where + +data family Sing (a :: k) + +data instance Sing (a :: Maybe k) where + SNothing :: Sing 'Nothing + SJust :: Sing b -> Sing ('Just b) + +data Nat = Zero | Succ Nat + +data instance Sing (a :: Nat) where + SZero :: Sing Zero + SSucc :: Sing n -> Sing (Succ n) + +term = SJust SZero diff --git a/testsuite/tests/polykinds/T7073.hs b/testsuite/tests/polykinds/T7073.hs index e406bcac8c..e0c66adb00 100644 --- a/testsuite/tests/polykinds/T7073.hs +++ b/testsuite/tests/polykinds/T7073.hs @@ -1,8 +1,8 @@ -{-# LANGUAGE PolyKinds, TypeFamilies #-}
-
-module T7073 where
-
-class Foo a where
- type Bar a
- type Bar a = Int
-
+{-# LANGUAGE PolyKinds, TypeFamilies #-} + +module T7073 where + +class Foo a where + type Bar a + type Bar a = Int + diff --git a/testsuite/tests/polykinds/T7272.hs b/testsuite/tests/polykinds/T7272.hs index 7589662469..0622fdac81 100644 --- a/testsuite/tests/polykinds/T7272.hs +++ b/testsuite/tests/polykinds/T7272.hs @@ -1,7 +1,7 @@ -{-# LANGUAGE PolyKinds #-}
-
-module T7272 where
-
-import T7272a
-
-class C (a :: k)
+{-# LANGUAGE PolyKinds #-} + +module T7272 where + +import T7272a + +class C (a :: k) diff --git a/testsuite/tests/polykinds/T7272a.hs b/testsuite/tests/polykinds/T7272a.hs index 3fe76776a0..b28223417c 100644 --- a/testsuite/tests/polykinds/T7272a.hs +++ b/testsuite/tests/polykinds/T7272a.hs @@ -1,5 +1,5 @@ -{-# LANGUAGE PolyKinds #-}
-
-module T7272a where
-
-import {-# SOURCE #-} T7272
+{-# LANGUAGE PolyKinds #-} + +module T7272a where + +import {-# SOURCE #-} T7272 diff --git a/testsuite/tests/polykinds/T7433.hs b/testsuite/tests/polykinds/T7433.hs index bb5d84cee3..26b283f11b 100644 --- a/testsuite/tests/polykinds/T7433.hs +++ b/testsuite/tests/polykinds/T7433.hs @@ -1,2 +1,2 @@ -data N = Z
-type T = 'Z
+data N = Z +type T = 'Z diff --git a/testsuite/tests/quasiquotation/T4491/A.hs b/testsuite/tests/quasiquotation/T4491/A.hs index 8c562d7221..dad3d03396 100644 --- a/testsuite/tests/quasiquotation/T4491/A.hs +++ b/testsuite/tests/quasiquotation/T4491/A.hs @@ -1,9 +1,9 @@ -{-# LANGUAGE DeriveDataTypeable #-}
-
-module A where
-
-import Data.Data
-import Data.Typeable
-
-data Foo = Foo Int
- deriving (Show, Data, Typeable)
+{-# LANGUAGE DeriveDataTypeable #-} + +module A where + +import Data.Data +import Data.Typeable + +data Foo = Foo Int + deriving (Show, Data, Typeable) diff --git a/testsuite/tests/quasiquotation/qq007/QQ.hs b/testsuite/tests/quasiquotation/qq007/QQ.hs index 3c13315a31..eee8dc9670 100644 --- a/testsuite/tests/quasiquotation/qq007/QQ.hs +++ b/testsuite/tests/quasiquotation/qq007/QQ.hs @@ -1,11 +1,11 @@ -{-# LANGUAGE TemplateHaskell #-}
-module QQ where
-
-import Language.Haskell.TH.Quote
-import Language.Haskell.TH
-
-pq = QuasiQuoter { quoteDec = \_ -> [d| f x = x |],
- quoteType = \_ -> [t| Int -> Int |],
- quoteExp = \_ -> [| $(varE (mkName "x")) + 1::Int |],
- quotePat = \_ -> [p| Just x |] }
-
+{-# LANGUAGE TemplateHaskell #-} +module QQ where + +import Language.Haskell.TH.Quote +import Language.Haskell.TH + +pq = QuasiQuoter { quoteDec = \_ -> [d| f x = x |], + quoteType = \_ -> [t| Int -> Int |], + quoteExp = \_ -> [| $(varE (mkName "x")) + 1::Int |], + quotePat = \_ -> [p| Just x |] } + diff --git a/testsuite/tests/quasiquotation/qq007/Test.hs b/testsuite/tests/quasiquotation/qq007/Test.hs index 42cef722d3..0f813219b1 100644 --- a/testsuite/tests/quasiquotation/qq007/Test.hs +++ b/testsuite/tests/quasiquotation/qq007/Test.hs @@ -1,13 +1,13 @@ -{-# LANGUAGE QuasiQuotes #-}
-module Test where
-
-import QQ
-
-f :: [pq| foo |] -- Expands to Int -> Int
-[pq| blah |] -- Expands to f x = x
-
-h [pq| foo |] = f [pq| blah |] * 8
- -- Expands to h (Just x) = f (x+1) * 8
-
-
-
+{-# LANGUAGE QuasiQuotes #-} +module Test where + +import QQ + +f :: [pq| foo |] -- Expands to Int -> Int +[pq| blah |] -- Expands to f x = x + +h [pq| foo |] = f [pq| blah |] * 8 + -- Expands to h (Just x) = f (x+1) * 8 + + + diff --git a/testsuite/tests/rebindable/T303.hs b/testsuite/tests/rebindable/T303.hs index 418a695e8d..c9be12469c 100644 --- a/testsuite/tests/rebindable/T303.hs +++ b/testsuite/tests/rebindable/T303.hs @@ -1,30 +1,30 @@ -{-# LANGUAGE RebindableSyntax #-}
-
--- Trac #303
-
-module T where
-import qualified Prelude as P
-
-class IxMonad m where
- return :: a -> m i i a
- (>>=) :: m i j a -> (a -> m j k b) -> m i k b
- (>>) :: m i j a -> m j k b -> m i k b
- m >> n = m >>= \_ -> n
-
- fail :: P.String -> m i j a
- fail s = P.error s
-
-data T a b c = T
-instance IxMonad T where
- return _ = T
- m >>= f = T
- fail _ = T
-
-testM :: T (a,b) b a
-testM = T
-
-test1 = testM >>= \x -> return x
-
-test2 = do
- x <- testM
- return x
+{-# LANGUAGE RebindableSyntax #-} + +-- Trac #303 + +module T where +import qualified Prelude as P + +class IxMonad m where + return :: a -> m i i a + (>>=) :: m i j a -> (a -> m j k b) -> m i k b + (>>) :: m i j a -> m j k b -> m i k b + m >> n = m >>= \_ -> n + + fail :: P.String -> m i j a + fail s = P.error s + +data T a b c = T +instance IxMonad T where + return _ = T + m >>= f = T + fail _ = T + +testM :: T (a,b) b a +testM = T + +test1 = testM >>= \x -> return x + +test2 = do + x <- testM + return x diff --git a/testsuite/tests/rebindable/rebindable7.hs b/testsuite/tests/rebindable/rebindable7.hs index 8e0000e0e5..01f3eda6dc 100644 --- a/testsuite/tests/rebindable/rebindable7.hs +++ b/testsuite/tests/rebindable/rebindable7.hs @@ -1,38 +1,38 @@ -{-# OPTIONS -XRebindableSyntax #-}
-
--- This one tests rebindable syntax for do-notation
-
-module Main where
-
-import qualified Prelude
-import GHC.Num
-import GHC.Base hiding( Monad(..) )
-
-class Foo a where
- op :: a -> a
-
-data T a = MkT a
-
-instance Foo Int where
- op x = x+1
-
-(>>=) :: Foo a => T a -> (a -> T b) -> T b
-(>>=) (MkT x) f = f (op x)
-
-(>>) :: Foo a => T a -> T b -> T b
-(>>) x y = x >>= (\_ -> y)
-
-return :: Num a => a -> T a
-return x = MkT (x+1)
-
-fail :: String -> T a
-fail s = error "urk"
-
-t1 :: T Int
-t1 = MkT 4
-
-myt = do { x <- t1
- ; return x }
-
-main = case myt of
- MkT i -> Prelude.print i
+{-# OPTIONS -XRebindableSyntax #-} + +-- This one tests rebindable syntax for do-notation + +module Main where + +import qualified Prelude +import GHC.Num +import GHC.Base hiding( Monad(..) ) + +class Foo a where + op :: a -> a + +data T a = MkT a + +instance Foo Int where + op x = x+1 + +(>>=) :: Foo a => T a -> (a -> T b) -> T b +(>>=) (MkT x) f = f (op x) + +(>>) :: Foo a => T a -> T b -> T b +(>>) x y = x >>= (\_ -> y) + +return :: Num a => a -> T a +return x = MkT (x+1) + +fail :: String -> T a +fail s = error "urk" + +t1 :: T Int +t1 = MkT 4 + +myt = do { x <- t1 + ; return x } + +main = case myt of + MkT i -> Prelude.print i diff --git a/testsuite/tests/rename/should_compile/T2436.hs b/testsuite/tests/rename/should_compile/T2436.hs index 5cfd64100a..29a14d8488 100644 --- a/testsuite/tests/rename/should_compile/T2436.hs +++ b/testsuite/tests/rename/should_compile/T2436.hs @@ -1,14 +1,14 @@ -{-# LANGUAGE TypeFamilies #-}
-{-# OPTIONS_GHC -fwarn-duplicate-exports #-}
-
-module T2436( C(..), T(..), module T2436a, S(..) ) where
-
-import T2436a
-
-class C a where
- data T a
-
-instance C Int where
- data T Int = TInt Int
-
-data instance S Int = SInt
\ No newline at end of file +{-# LANGUAGE TypeFamilies #-} +{-# OPTIONS_GHC -fwarn-duplicate-exports #-} + +module T2436( C(..), T(..), module T2436a, S(..) ) where + +import T2436a + +class C a where + data T a + +instance C Int where + data T Int = TInt Int + +data instance S Int = SInt diff --git a/testsuite/tests/rename/should_compile/T2436a.hs b/testsuite/tests/rename/should_compile/T2436a.hs index 4813fd918d..72f04df916 100644 --- a/testsuite/tests/rename/should_compile/T2436a.hs +++ b/testsuite/tests/rename/should_compile/T2436a.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE TypeFamilies #-}
-module T2436a( S ) where
-
-data family S a
\ No newline at end of file +{-# LANGUAGE TypeFamilies #-} +module T2436a( S ) where + +data family S a diff --git a/testsuite/tests/rename/should_compile/T3943.hs b/testsuite/tests/rename/should_compile/T3943.hs index efbeb295be..06a1818bbb 100644 --- a/testsuite/tests/rename/should_compile/T3943.hs +++ b/testsuite/tests/rename/should_compile/T3943.hs @@ -1,10 +1,10 @@ -{-# OPTIONS_GHC -Wall #-}
-{-# LANGUAGE ViewPatterns #-}
-
-module T3943 where
-
--- Note that 'r' is used, in the view pattern
--- The bug was that 'r' was reported unused
-
-test :: ([a], [a]) -> [a]
-test x = let (r,(r++) -> rs) = x in rs
+{-# OPTIONS_GHC -Wall #-} +{-# LANGUAGE ViewPatterns #-} + +module T3943 where + +-- Note that 'r' is used, in the view pattern +-- The bug was that 'r' was reported unused + +test :: ([a], [a]) -> [a] +test x = let (r,(r++) -> rs) = x in rs diff --git a/testsuite/tests/rename/should_compile/T4489.hs b/testsuite/tests/rename/should_compile/T4489.hs index a967cad06d..04361281ed 100644 --- a/testsuite/tests/rename/should_compile/T4489.hs +++ b/testsuite/tests/rename/should_compile/T4489.hs @@ -1,6 +1,6 @@ -{-# OPTIONS_GHC -fwarn-missing-import-lists #-}
-module T4489 where
-
-import Data.Maybe
-import Data.Maybe( Maybe(..) )
-import Data.Maybe( Maybe(Just) )
+{-# OPTIONS_GHC -fwarn-missing-import-lists #-} +module T4489 where + +import Data.Maybe +import Data.Maybe( Maybe(..) ) +import Data.Maybe( Maybe(Just) ) diff --git a/testsuite/tests/rename/should_compile/T5306.hs b/testsuite/tests/rename/should_compile/T5306.hs index 641176b758..8a4aec3774 100644 --- a/testsuite/tests/rename/should_compile/T5306.hs +++ b/testsuite/tests/rename/should_compile/T5306.hs @@ -1,5 +1,5 @@ -{-# LANGUAGE TypeFamilies #-}
-module T5306 where
-
-import T5306b(F(FInt)) -- succeeds
-import T5306a(F(FBool)) -- failed (before fix)
+{-# LANGUAGE TypeFamilies #-} +module T5306 where + +import T5306b(F(FInt)) -- succeeds +import T5306a(F(FBool)) -- failed (before fix) diff --git a/testsuite/tests/rename/should_compile/T5306a.hs b/testsuite/tests/rename/should_compile/T5306a.hs index 783131b11f..9c3d4cff97 100644 --- a/testsuite/tests/rename/should_compile/T5306a.hs +++ b/testsuite/tests/rename/should_compile/T5306a.hs @@ -1,5 +1,5 @@ -{-# LANGUAGE TypeFamilies #-}
-module T5306a( F(..) ) where
-import T5306b
-
-data instance F Bool = FBool
+{-# LANGUAGE TypeFamilies #-} +module T5306a( F(..) ) where +import T5306b + +data instance F Bool = FBool diff --git a/testsuite/tests/rename/should_compile/T5306b.hs b/testsuite/tests/rename/should_compile/T5306b.hs index 4801b79db7..728e279c50 100644 --- a/testsuite/tests/rename/should_compile/T5306b.hs +++ b/testsuite/tests/rename/should_compile/T5306b.hs @@ -1,5 +1,5 @@ -{-# LANGUAGE TypeFamilies #-}
-module T5306b where
-
-data family F a
-data instance F Int = FInt
+{-# LANGUAGE TypeFamilies #-} +module T5306b where + +data family F a +data instance F Int = FInt diff --git a/testsuite/tests/rename/should_compile/T7007.hs b/testsuite/tests/rename/should_compile/T7007.hs index 73a6f06b76..638f074e02 100644 --- a/testsuite/tests/rename/should_compile/T7007.hs +++ b/testsuite/tests/rename/should_compile/T7007.hs @@ -1,10 +1,10 @@ -module T7007 where
-
-import Data.Monoid( Monoid(..) )
-
-infixr 5 ++ -- This unambiguously refers to the local definition
-
-(++) :: Monoid a => a -> a -> a
-(++) = mappend
-
-
+module T7007 where + +import Data.Monoid( Monoid(..) ) + +infixr 5 ++ -- This unambiguously refers to the local definition + +(++) :: Monoid a => a -> a -> a +(++) = mappend + + diff --git a/testsuite/tests/rename/should_compile/T7336.hs b/testsuite/tests/rename/should_compile/T7336.hs index 166bae6076..c218faad0e 100644 --- a/testsuite/tests/rename/should_compile/T7336.hs +++ b/testsuite/tests/rename/should_compile/T7336.hs @@ -1,8 +1,8 @@ -module T7336 ( U, T ) where
-
-data U = MkU deriving Show
--- Want to report MkU as unused
-
-data T = MkT deriving Read
--- But MkT is not unused; we might
--- parse a string to generate it
+module T7336 ( U, T ) where + +data U = MkU deriving Show +-- Want to report MkU as unused + +data T = MkT deriving Read +-- But MkT is not unused; we might +-- parse a string to generate it diff --git a/testsuite/tests/rename/should_fail/T2723.hs b/testsuite/tests/rename/should_fail/T2723.hs index 74f11af778..ca766eea02 100644 --- a/testsuite/tests/rename/should_fail/T2723.hs +++ b/testsuite/tests/rename/should_fail/T2723.hs @@ -1,16 +1,16 @@ -{-# OPTIONS_GHC -fwarn-name-shadowing -XNamedFieldPuns -XRecordWildCards #-}
-module WildCard where
-
-data Record = Record {field1 :: Int, field2 :: Double}
-
-field3 :: Int
-field3 = 3
-
-test1 (Record {field1, field2}) = let test = 1 in field1
-
-test2 :: (Record, Int)
-test2 = let
- field1 = 10
- field2 = 10.0
- field3 = 8
- in (Record {..}, field3)
+{-# OPTIONS_GHC -fwarn-name-shadowing -XNamedFieldPuns -XRecordWildCards #-} +module WildCard where + +data Record = Record {field1 :: Int, field2 :: Double} + +field3 :: Int +field3 = 3 + +test1 (Record {field1, field2}) = let test = 1 in field1 + +test2 :: (Record, Int) +test2 = let + field1 = 10 + field2 = 10.0 + field3 = 8 + in (Record {..}, field3) diff --git a/testsuite/tests/rename/should_fail/T3792.hs b/testsuite/tests/rename/should_fail/T3792.hs index e01efb9418..e53dd262b4 100644 --- a/testsuite/tests/rename/should_fail/T3792.hs +++ b/testsuite/tests/rename/should_fail/T3792.hs @@ -1,4 +1,4 @@ -module T3792 where
-
-import Prelude( Prelude.map ) -- Illegal
-
+module T3792 where + +import Prelude( Prelude.map ) -- Illegal + diff --git a/testsuite/tests/rename/should_fail/T5211.hs b/testsuite/tests/rename/should_fail/T5211.hs index 2d0e69af7b..56c958cd1e 100644 --- a/testsuite/tests/rename/should_fail/T5211.hs +++ b/testsuite/tests/rename/should_fail/T5211.hs @@ -1,16 +1,16 @@ -{-# OPTIONS_GHC -fwarn-unused-imports #-}
-module RedundantImport where
-
--- this import is redundant, but GHC does not spot it
-import qualified Foreign.Storable
-
-import Foreign.Storable (Storable, sizeOf, alignment, peek, poke, )
-import Foreign.Ptr (castPtr, )
-
-newtype T a = Cons a
-
-instance Storable a => Storable (T a) where
- sizeOf (Cons a) = sizeOf a
- alignment (Cons a) = alignment a
- peek = fmap Cons . peek . castPtr
- poke p (Cons a) = poke (castPtr p) a
+{-# OPTIONS_GHC -fwarn-unused-imports #-} +module RedundantImport where + +-- this import is redundant, but GHC does not spot it +import qualified Foreign.Storable + +import Foreign.Storable (Storable, sizeOf, alignment, peek, poke, ) +import Foreign.Ptr (castPtr, ) + +newtype T a = Cons a + +instance Storable a => Storable (T a) where + sizeOf (Cons a) = sizeOf a + alignment (Cons a) = alignment a + peek = fmap Cons . peek . castPtr + poke p (Cons a) = poke (castPtr p) a diff --git a/testsuite/tests/rename/should_fail/T9436.hs b/testsuite/tests/rename/should_fail/T9436.hs index dd2d733d73..2541035872 100644 --- a/testsuite/tests/rename/should_fail/T9436.hs +++ b/testsuite/tests/rename/should_fail/T9436.hs @@ -1,8 +1,8 @@ -{-# LANGUAGE RecordWildCards #-}
-
-module T9436 where
-
-data T = T { x :: Int }
-
-f :: T -> Int
-f (T' { .. }) = x + 1
+{-# LANGUAGE RecordWildCards #-} + +module T9436 where + +data T = T { x :: Int } + +f :: T -> Int +f (T' { .. }) = x + 1 diff --git a/testsuite/tests/rename/should_fail/T9437.hs b/testsuite/tests/rename/should_fail/T9437.hs index cd2ad7febd..acc6ff8a87 100644 --- a/testsuite/tests/rename/should_fail/T9437.hs +++ b/testsuite/tests/rename/should_fail/T9437.hs @@ -1,8 +1,8 @@ -{-# LANGUAGE RecordWildCards #-}
-
-module T9437 where
-
-data Foo = Foo { x :: Int }
-
-test :: Foo -> Foo
-test foo = foo { .. }
+{-# LANGUAGE RecordWildCards #-} + +module T9437 where + +data Foo = Foo { x :: Int } + +test :: Foo -> Foo +test foo = foo { .. } diff --git a/testsuite/tests/rename/should_fail/rnfail043.hs b/testsuite/tests/rename/should_fail/rnfail043.hs index 492cebb516..a978b807ad 100644 --- a/testsuite/tests/rename/should_fail/rnfail043.hs +++ b/testsuite/tests/rename/should_fail/rnfail043.hs @@ -1,10 +1,10 @@ -{-# LANGUAGE TemplateHaskell #-}
-
--- Duplicate bindings introduced one at a time with TH
-module ShouldFail where
-
-f x = x
-
-$([d| h x = x |])
-
-f x = x
+{-# LANGUAGE TemplateHaskell #-} + +-- Duplicate bindings introduced one at a time with TH +module ShouldFail where + +f x = x + +$([d| h x = x |]) + +f x = x diff --git a/testsuite/tests/rename/should_fail/rnfail046.hs b/testsuite/tests/rename/should_fail/rnfail046.hs index f8aa7a734c..1195214728 100644 --- a/testsuite/tests/rename/should_fail/rnfail046.hs +++ b/testsuite/tests/rename/should_fail/rnfail046.hs @@ -1,4 +1,4 @@ --- Qualified name in binding position
-module ShouldFail where
-
-data Test = Map.Map Int Int
+-- Qualified name in binding position +module ShouldFail where + +data Test = Map.Map Int Int diff --git a/testsuite/tests/rename/should_fail/rnfail049.hs b/testsuite/tests/rename/should_fail/rnfail049.hs index 0d426a4a27..1ae3da6d00 100644 --- a/testsuite/tests/rename/should_fail/rnfail049.hs +++ b/testsuite/tests/rename/should_fail/rnfail049.hs @@ -1,14 +1,14 @@ --- Test trying to use a function bound in the list comprehension as the group function
-
-{-# OPTIONS_GHC -XRankNTypes -XTransformListComp #-}
-
-module RnFail049 where
-
-import Data.List(inits, tails)
-
-functions :: [[a] -> [[a]]]
-functions = [inits, tails]
-
-output = [() | f <- functions, then group using f]
-
-
+-- Test trying to use a function bound in the list comprehension as the group function + +{-# OPTIONS_GHC -XRankNTypes -XTransformListComp #-} + +module RnFail049 where + +import Data.List(inits, tails) + +functions :: [[a] -> [[a]]] +functions = [inits, tails] + +output = [() | f <- functions, then group using f] + + |