module Language.Fortran.AST.AList where

import Language.Fortran.Util.FirstParameter
import Language.Fortran.Util.SecondParameter
import Language.Fortran.Util.Position (Spanned, SrcSpan(..), getSpan)
import Language.Fortran.AST.Annotated ( Annotated )

import Data.Data    (Data)
import GHC.Generics (Generic)
import Control.DeepSeq (NFData)
import Text.PrettyPrint.GenericPretty (Out)

-- | A location-tagged list of @t a@s (@t@ decorated with an @a@ annotation).
--
-- The AST is polymorphic on some type @a@, which is used for arbitrary
-- annotations. Since many AST nodes use lists (e.g. executable statements,
-- declarations), we define a dedicated annotated list type to reuse.
--
-- Note that the list itself also holds an @a@ annotation.
data AList t a = AList
  { forall (t :: * -> *) a. AList t a -> a
alistAnno :: a
  , forall (t :: * -> *) a. AList t a -> SrcSpan
alistSpan :: SrcSpan
  , forall (t :: * -> *) a. AList t a -> [t a]
alistList :: [t a]
  } deriving stock (AList t a -> AList t a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (t :: * -> *) a.
(Eq a, Eq (t a)) =>
AList t a -> AList t a -> Bool
/= :: AList t a -> AList t a -> Bool
$c/= :: forall (t :: * -> *) a.
(Eq a, Eq (t a)) =>
AList t a -> AList t a -> Bool
== :: AList t a -> AList t a -> Bool
$c== :: forall (t :: * -> *) a.
(Eq a, Eq (t a)) =>
AList t a -> AList t a -> Bool
Eq, Int -> AList t a -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall (t :: * -> *) a.
(Show a, Show (t a)) =>
Int -> AList t a -> ShowS
forall (t :: * -> *) a.
(Show a, Show (t a)) =>
[AList t a] -> ShowS
forall (t :: * -> *) a. (Show a, Show (t a)) => AList t a -> String
showList :: [AList t a] -> ShowS
$cshowList :: forall (t :: * -> *) a.
(Show a, Show (t a)) =>
[AList t a] -> ShowS
show :: AList t a -> String
$cshow :: forall (t :: * -> *) a. (Show a, Show (t a)) => AList t a -> String
showsPrec :: Int -> AList t a -> ShowS
$cshowsPrec :: forall (t :: * -> *) a.
(Show a, Show (t a)) =>
Int -> AList t a -> ShowS
Show, AList t a -> DataType
AList t a -> Constr
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (AList t a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AList t a -> c (AList t a)
forall {t :: * -> *} {a}.
(Typeable t, Data a, Data (t a)) =>
Typeable (AList t a)
forall (t :: * -> *) a.
(Typeable t, Data a, Data (t a)) =>
AList t a -> DataType
forall (t :: * -> *) a.
(Typeable t, Data a, Data (t a)) =>
AList t a -> Constr
forall (t :: * -> *) a.
(Typeable t, Data a, Data (t a)) =>
(forall b. Data b => b -> b) -> AList t a -> AList t a
forall (t :: * -> *) a u.
(Typeable t, Data a, Data (t a)) =>
Int -> (forall d. Data d => d -> u) -> AList t a -> u
forall (t :: * -> *) a u.
(Typeable t, Data a, Data (t a)) =>
(forall d. Data d => d -> u) -> AList t a -> [u]
forall (t :: * -> *) a r r'.
(Typeable t, Data a, Data (t a)) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AList t a -> r
forall (t :: * -> *) a r r'.
(Typeable t, Data a, Data (t a)) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AList t a -> r
forall (t :: * -> *) a (m :: * -> *).
(Typeable t, Data a, Data (t a), Monad m) =>
(forall d. Data d => d -> m d) -> AList t a -> m (AList t a)
forall (t :: * -> *) a (m :: * -> *).
(Typeable t, Data a, Data (t a), MonadPlus m) =>
(forall d. Data d => d -> m d) -> AList t a -> m (AList t a)
forall (t :: * -> *) a (c :: * -> *).
(Typeable t, Data a, Data (t a)) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (AList t a)
forall (t :: * -> *) a (c :: * -> *).
(Typeable t, Data a, Data (t a)) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AList t a -> c (AList t a)
forall (t :: * -> *) a (t :: * -> *) (c :: * -> *).
(Typeable t, Data a, Data (t a), Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (AList t a))
forall (t :: * -> *) a (t :: * -> * -> *) (c :: * -> *).
(Typeable t, Data a, Data (t a), Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (AList t a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AList t a -> m (AList t a)
$cgmapMo :: forall (t :: * -> *) a (m :: * -> *).
(Typeable t, Data a, Data (t a), MonadPlus m) =>
(forall d. Data d => d -> m d) -> AList t a -> m (AList t a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AList t a -> m (AList t a)
$cgmapMp :: forall (t :: * -> *) a (m :: * -> *).
(Typeable t, Data a, Data (t a), MonadPlus m) =>
(forall d. Data d => d -> m d) -> AList t a -> m (AList t a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> AList t a -> m (AList t a)
$cgmapM :: forall (t :: * -> *) a (m :: * -> *).
(Typeable t, Data a, Data (t a), Monad m) =>
(forall d. Data d => d -> m d) -> AList t a -> m (AList t a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> AList t a -> u
$cgmapQi :: forall (t :: * -> *) a u.
(Typeable t, Data a, Data (t a)) =>
Int -> (forall d. Data d => d -> u) -> AList t a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> AList t a -> [u]
$cgmapQ :: forall (t :: * -> *) a u.
(Typeable t, Data a, Data (t a)) =>
(forall d. Data d => d -> u) -> AList t a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AList t a -> r
$cgmapQr :: forall (t :: * -> *) a r r'.
(Typeable t, Data a, Data (t a)) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AList t a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AList t a -> r
$cgmapQl :: forall (t :: * -> *) a r r'.
(Typeable t, Data a, Data (t a)) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AList t a -> r
gmapT :: (forall b. Data b => b -> b) -> AList t a -> AList t a
$cgmapT :: forall (t :: * -> *) a.
(Typeable t, Data a, Data (t a)) =>
(forall b. Data b => b -> b) -> AList t a -> AList t a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (AList t a))
$cdataCast2 :: forall (t :: * -> *) a (t :: * -> * -> *) (c :: * -> *).
(Typeable t, Data a, Data (t a), Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (AList t a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (AList t a))
$cdataCast1 :: forall (t :: * -> *) a (t :: * -> *) (c :: * -> *).
(Typeable t, Data a, Data (t a), Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (AList t a))
dataTypeOf :: AList t a -> DataType
$cdataTypeOf :: forall (t :: * -> *) a.
(Typeable t, Data a, Data (t a)) =>
AList t a -> DataType
toConstr :: AList t a -> Constr
$ctoConstr :: forall (t :: * -> *) a.
(Typeable t, Data a, Data (t a)) =>
AList t a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (AList t a)
$cgunfold :: forall (t :: * -> *) a (c :: * -> *).
(Typeable t, Data a, Data (t a)) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (AList t a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AList t a -> c (AList t a)
$cgfoldl :: forall (t :: * -> *) a (c :: * -> *).
(Typeable t, Data a, Data (t a)) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AList t a -> c (AList t a)
Data, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (t :: * -> *) a x. Rep (AList t a) x -> AList t a
forall (t :: * -> *) a x. AList t a -> Rep (AList t a) x
$cto :: forall (t :: * -> *) a x. Rep (AList t a) x -> AList t a
$cfrom :: forall (t :: * -> *) a x. AList t a -> Rep (AList t a) x
Generic)

instance Functor t => Functor (AList t) where
  fmap :: forall a b. (a -> b) -> AList t a -> AList t b
fmap a -> b
f (AList a
a SrcSpan
s [t a]
xs) = forall (t :: * -> *) a. a -> SrcSpan -> [t a] -> AList t a
AList (a -> b
f a
a) SrcSpan
s (forall a b. (a -> b) -> [a] -> [b]
map (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f) [t a]
xs)

instance FirstParameter (AList t a) a
instance SecondParameter (AList t a) SrcSpan
instance Annotated (AList t)
instance Spanned (AList t a)
instance (Out a, Out (t a)) => Out (AList t a)
instance (NFData a, NFData (t a)) => NFData (AList t a)

-- | Convert a non-empty list to an 'AList'.
fromList :: Spanned (t a) => a -> [ t a ] -> AList t a
fromList :: forall (t :: * -> *) a. Spanned (t a) => a -> [t a] -> AList t a
fromList a
a [t a]
xs = forall (t :: * -> *) a. a -> SrcSpan -> [t a] -> AList t a
AList a
a (forall a. Spanned a => a -> SrcSpan
getSpan [t a]
xs) [t a]
xs

-- | Convert a list to an 'AList', returning Nothing iff the list is empty.
fromList' :: Spanned (t a) => a -> [ t a ] -> Maybe (AList t a)
fromList' :: forall (t :: * -> *) a.
Spanned (t a) =>
a -> [t a] -> Maybe (AList t a)
fromList' a
_ [] = forall a. Maybe a
Nothing
fromList' a
a [t a]
xs = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) a. Spanned (t a) => a -> [t a] -> AList t a
fromList a
a [t a]
xs

fromReverseList :: Spanned (t ()) => [ t () ] -> AList t ()
fromReverseList :: forall (t :: * -> *). Spanned (t ()) => [t ()] -> AList t ()
fromReverseList = forall (t :: * -> *) a. Spanned (t a) => a -> [t a] -> AList t a
fromList () forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. [a] -> [a]
reverse

fromReverseList' :: Spanned (t ()) => [ t () ] -> Maybe (AList t ())
fromReverseList' :: forall (t :: * -> *).
Spanned (t ()) =>
[t ()] -> Maybe (AList t ())
fromReverseList' = forall (t :: * -> *) a.
Spanned (t a) =>
a -> [t a] -> Maybe (AList t a)
fromList' () forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. [a] -> [a]
reverse

aCons :: t a -> AList t a -> AList t a
aCons :: forall (t :: * -> *) a. t a -> AList t a -> AList t a
aCons t a
x (AList a
a SrcSpan
s [t a]
xs) = forall (t :: * -> *) a. a -> SrcSpan -> [t a] -> AList t a
AList a
a SrcSpan
s forall a b. (a -> b) -> a -> b
$ t a
xforall a. a -> [a] -> [a]
:[t a]
xs

infixr 5 `aCons`

aEmpty :: a -> SrcSpan -> AList t a
aEmpty :: forall a (t :: * -> *). a -> SrcSpan -> AList t a
aEmpty a
a SrcSpan
s = forall (t :: * -> *) a. a -> SrcSpan -> [t a] -> AList t a
AList a
a SrcSpan
s []

aReverse :: AList t a -> AList t a
aReverse :: forall (t :: * -> *) a. AList t a -> AList t a
aReverse (AList a
a SrcSpan
s [t a]
xs) = forall (t :: * -> *) a. a -> SrcSpan -> [t a] -> AList t a
AList a
a SrcSpan
s forall a b. (a -> b) -> a -> b
$ forall a. [a] -> [a]
reverse [t a]
xs

aStrip :: AList t a -> [t a]
aStrip :: forall (t :: * -> *) a. AList t a -> [t a]
aStrip (AList a
_ SrcSpan
_ [t a]
l) = [t a]
l

aStrip' :: Maybe (AList t a) -> [t a]
aStrip' :: forall (t :: * -> *) a. Maybe (AList t a) -> [t a]
aStrip' Maybe (AList t a)
Nothing = []
aStrip' (Just AList t a
a) = forall (t :: * -> *) a. AList t a -> [t a]
aStrip AList t a
a

aMap :: (t a -> r a) -> AList t a -> AList r a
aMap :: forall (t :: * -> *) a (r :: * -> *).
(t a -> r a) -> AList t a -> AList r a
aMap t a -> r a
f (AList a
a SrcSpan
s [t a]
xs) = forall (t :: * -> *) a. a -> SrcSpan -> [t a] -> AList t a
AList a
a SrcSpan
s (forall a b. (a -> b) -> [a] -> [b]
map t a -> r a
f [t a]
xs)

--------------------------------------------------------------------------------

data ATuple t1 t2 a = ATuple
  { forall (t1 :: * -> *) (t2 :: * -> *) a. ATuple t1 t2 a -> a
atupleAnno :: a
  , forall (t1 :: * -> *) (t2 :: * -> *) a. ATuple t1 t2 a -> SrcSpan
atupleSpan :: SrcSpan
  , forall (t1 :: * -> *) (t2 :: * -> *) a. ATuple t1 t2 a -> t1 a
atupleFst  :: t1 a
  , forall (t1 :: * -> *) (t2 :: * -> *) a. ATuple t1 t2 a -> t2 a
atupleSnd  :: t2 a
  } deriving stock (ATuple t1 t2 a -> ATuple t1 t2 a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (t1 :: * -> *) (t2 :: * -> *) a.
(Eq a, Eq (t1 a), Eq (t2 a)) =>
ATuple t1 t2 a -> ATuple t1 t2 a -> Bool
/= :: ATuple t1 t2 a -> ATuple t1 t2 a -> Bool
$c/= :: forall (t1 :: * -> *) (t2 :: * -> *) a.
(Eq a, Eq (t1 a), Eq (t2 a)) =>
ATuple t1 t2 a -> ATuple t1 t2 a -> Bool
== :: ATuple t1 t2 a -> ATuple t1 t2 a -> Bool
$c== :: forall (t1 :: * -> *) (t2 :: * -> *) a.
(Eq a, Eq (t1 a), Eq (t2 a)) =>
ATuple t1 t2 a -> ATuple t1 t2 a -> Bool
Eq, Int -> ATuple t1 t2 a -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall (t1 :: * -> *) (t2 :: * -> *) a.
(Show a, Show (t1 a), Show (t2 a)) =>
Int -> ATuple t1 t2 a -> ShowS
forall (t1 :: * -> *) (t2 :: * -> *) a.
(Show a, Show (t1 a), Show (t2 a)) =>
[ATuple t1 t2 a] -> ShowS
forall (t1 :: * -> *) (t2 :: * -> *) a.
(Show a, Show (t1 a), Show (t2 a)) =>
ATuple t1 t2 a -> String
showList :: [ATuple t1 t2 a] -> ShowS
$cshowList :: forall (t1 :: * -> *) (t2 :: * -> *) a.
(Show a, Show (t1 a), Show (t2 a)) =>
[ATuple t1 t2 a] -> ShowS
show :: ATuple t1 t2 a -> String
$cshow :: forall (t1 :: * -> *) (t2 :: * -> *) a.
(Show a, Show (t1 a), Show (t2 a)) =>
ATuple t1 t2 a -> String
showsPrec :: Int -> ATuple t1 t2 a -> ShowS
$cshowsPrec :: forall (t1 :: * -> *) (t2 :: * -> *) a.
(Show a, Show (t1 a), Show (t2 a)) =>
Int -> ATuple t1 t2 a -> ShowS
Show, ATuple t1 t2 a -> DataType
ATuple t1 t2 a -> Constr
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ATuple t1 t2 a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ATuple t1 t2 a -> c (ATuple t1 t2 a)
forall {t1 :: * -> *} {t2 :: * -> *} {a}.
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a)) =>
Typeable (ATuple t1 t2 a)
forall (t1 :: * -> *) (t2 :: * -> *) a.
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a)) =>
ATuple t1 t2 a -> DataType
forall (t1 :: * -> *) (t2 :: * -> *) a.
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a)) =>
ATuple t1 t2 a -> Constr
forall (t1 :: * -> *) (t2 :: * -> *) a.
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a)) =>
(forall b. Data b => b -> b) -> ATuple t1 t2 a -> ATuple t1 t2 a
forall (t1 :: * -> *) (t2 :: * -> *) a u.
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a)) =>
Int -> (forall d. Data d => d -> u) -> ATuple t1 t2 a -> u
forall (t1 :: * -> *) (t2 :: * -> *) a u.
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a)) =>
(forall d. Data d => d -> u) -> ATuple t1 t2 a -> [u]
forall (t1 :: * -> *) (t2 :: * -> *) a r r'.
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a)) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ATuple t1 t2 a -> r
forall (t1 :: * -> *) (t2 :: * -> *) a r r'.
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a)) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ATuple t1 t2 a -> r
forall (t1 :: * -> *) (t2 :: * -> *) a (m :: * -> *).
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a),
 Monad m) =>
(forall d. Data d => d -> m d)
-> ATuple t1 t2 a -> m (ATuple t1 t2 a)
forall (t1 :: * -> *) (t2 :: * -> *) a (m :: * -> *).
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a),
 MonadPlus m) =>
(forall d. Data d => d -> m d)
-> ATuple t1 t2 a -> m (ATuple t1 t2 a)
forall (t1 :: * -> *) (t2 :: * -> *) a (c :: * -> *).
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a)) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ATuple t1 t2 a)
forall (t1 :: * -> *) (t2 :: * -> *) a (c :: * -> *).
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a)) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ATuple t1 t2 a -> c (ATuple t1 t2 a)
forall (t1 :: * -> *) (t2 :: * -> *) a (t :: * -> *) (c :: * -> *).
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a),
 Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (ATuple t1 t2 a))
forall (t1 :: * -> *) (t2 :: * -> *) a (t :: * -> * -> *)
       (c :: * -> *).
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a),
 Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ATuple t1 t2 a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ATuple t1 t2 a -> m (ATuple t1 t2 a)
$cgmapMo :: forall (t1 :: * -> *) (t2 :: * -> *) a (m :: * -> *).
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a),
 MonadPlus m) =>
(forall d. Data d => d -> m d)
-> ATuple t1 t2 a -> m (ATuple t1 t2 a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ATuple t1 t2 a -> m (ATuple t1 t2 a)
$cgmapMp :: forall (t1 :: * -> *) (t2 :: * -> *) a (m :: * -> *).
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a),
 MonadPlus m) =>
(forall d. Data d => d -> m d)
-> ATuple t1 t2 a -> m (ATuple t1 t2 a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ATuple t1 t2 a -> m (ATuple t1 t2 a)
$cgmapM :: forall (t1 :: * -> *) (t2 :: * -> *) a (m :: * -> *).
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a),
 Monad m) =>
(forall d. Data d => d -> m d)
-> ATuple t1 t2 a -> m (ATuple t1 t2 a)
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> ATuple t1 t2 a -> u
$cgmapQi :: forall (t1 :: * -> *) (t2 :: * -> *) a u.
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a)) =>
Int -> (forall d. Data d => d -> u) -> ATuple t1 t2 a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> ATuple t1 t2 a -> [u]
$cgmapQ :: forall (t1 :: * -> *) (t2 :: * -> *) a u.
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a)) =>
(forall d. Data d => d -> u) -> ATuple t1 t2 a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ATuple t1 t2 a -> r
$cgmapQr :: forall (t1 :: * -> *) (t2 :: * -> *) a r r'.
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a)) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ATuple t1 t2 a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ATuple t1 t2 a -> r
$cgmapQl :: forall (t1 :: * -> *) (t2 :: * -> *) a r r'.
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a)) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ATuple t1 t2 a -> r
gmapT :: (forall b. Data b => b -> b) -> ATuple t1 t2 a -> ATuple t1 t2 a
$cgmapT :: forall (t1 :: * -> *) (t2 :: * -> *) a.
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a)) =>
(forall b. Data b => b -> b) -> ATuple t1 t2 a -> ATuple t1 t2 a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ATuple t1 t2 a))
$cdataCast2 :: forall (t1 :: * -> *) (t2 :: * -> *) a (t :: * -> * -> *)
       (c :: * -> *).
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a),
 Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ATuple t1 t2 a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (ATuple t1 t2 a))
$cdataCast1 :: forall (t1 :: * -> *) (t2 :: * -> *) a (t :: * -> *) (c :: * -> *).
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a),
 Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (ATuple t1 t2 a))
dataTypeOf :: ATuple t1 t2 a -> DataType
$cdataTypeOf :: forall (t1 :: * -> *) (t2 :: * -> *) a.
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a)) =>
ATuple t1 t2 a -> DataType
toConstr :: ATuple t1 t2 a -> Constr
$ctoConstr :: forall (t1 :: * -> *) (t2 :: * -> *) a.
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a)) =>
ATuple t1 t2 a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ATuple t1 t2 a)
$cgunfold :: forall (t1 :: * -> *) (t2 :: * -> *) a (c :: * -> *).
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a)) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ATuple t1 t2 a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ATuple t1 t2 a -> c (ATuple t1 t2 a)
$cgfoldl :: forall (t1 :: * -> *) (t2 :: * -> *) a (c :: * -> *).
(Typeable t1, Typeable t2, Data a, Data (t1 a), Data (t2 a)) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ATuple t1 t2 a -> c (ATuple t1 t2 a)
Data, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (t1 :: * -> *) (t2 :: * -> *) a x.
Rep (ATuple t1 t2 a) x -> ATuple t1 t2 a
forall (t1 :: * -> *) (t2 :: * -> *) a x.
ATuple t1 t2 a -> Rep (ATuple t1 t2 a) x
$cto :: forall (t1 :: * -> *) (t2 :: * -> *) a x.
Rep (ATuple t1 t2 a) x -> ATuple t1 t2 a
$cfrom :: forall (t1 :: * -> *) (t2 :: * -> *) a x.
ATuple t1 t2 a -> Rep (ATuple t1 t2 a) x
Generic, forall a b. a -> ATuple t1 t2 b -> ATuple t1 t2 a
forall a b. (a -> b) -> ATuple t1 t2 a -> ATuple t1 t2 b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
forall (t1 :: * -> *) (t2 :: * -> *) a b.
(Functor t1, Functor t2) =>
a -> ATuple t1 t2 b -> ATuple t1 t2 a
forall (t1 :: * -> *) (t2 :: * -> *) a b.
(Functor t1, Functor t2) =>
(a -> b) -> ATuple t1 t2 a -> ATuple t1 t2 b
<$ :: forall a b. a -> ATuple t1 t2 b -> ATuple t1 t2 a
$c<$ :: forall (t1 :: * -> *) (t2 :: * -> *) a b.
(Functor t1, Functor t2) =>
a -> ATuple t1 t2 b -> ATuple t1 t2 a
fmap :: forall a b. (a -> b) -> ATuple t1 t2 a -> ATuple t1 t2 b
$cfmap :: forall (t1 :: * -> *) (t2 :: * -> *) a b.
(Functor t1, Functor t2) =>
(a -> b) -> ATuple t1 t2 a -> ATuple t1 t2 b
Functor)

instance FirstParameter (ATuple t1 t2 a) a
instance SecondParameter (ATuple t1 t2 a) SrcSpan
instance Spanned (ATuple t1 t2 a)
instance (Out a, Out (t1 a), Out (t2 a)) => Out (ATuple t1 t2 a)
instance (NFData a, NFData (t1 a), NFData (t2 a)) => NFData (ATuple t1 t2 a)

--------------------------------------------------------------------------------

{-

see issue #231

data AListX ext t a = AListX
  { alistxAnno :: a
  , alistxSpan :: SrcSpan
  , alistxList :: [t a]
  , alistxExt  :: ext
  } deriving stock (Eq, Show, Data, Generic)

instance Functor t => Functor (AListX ext t) where
  fmap f (AListX a s xs ext) = AListX (f a) s (map (fmap f) xs) ext

instance FirstParameter (AListX ext t a) a
instance SecondParameter (AListX ext t a) SrcSpan
instance Annotated (AListX ext t)
instance Spanned (AListX ext t a)
instance (Out a, Out (t a), Out ext) => Out (AListX ext t a)
instance (NFData a, NFData (t a), NFData ext) => NFData (AListX ext t a)

data Brackets = Brackets | OmitBrackets
    deriving stock    (Eq, Show, Data, Generic)
    deriving anyclass (NFData, Out)

-}