    {-# Language ImplicitParams #-}
    module Cryptol.IR.TraverseNames where

    import Data.Set(Set)
    import qualified Data.Set as Set
    import Data.Functor.Identity

    import Cryptol.ModuleSystem.Name(nameUnique)
    import Cryptol.Utils.RecordMap(traverseRecordMap)
    import Cryptol.Parser.Position(Located(..))
    import Cryptol.TypeCheck.AST
    import Cryptol.TypeCheck.FFI.FFIType

    traverseNames ::
      (TraverseNames t, Applicative f) => (Name -> f Name) -> (t -> f t)
    traverseNames :: forall t (f :: * -> *).
    (TraverseNames t, Applicative f) =>
    (Name -> f Name) -> t -> f t
    traverseNames Name -> f Name
    f = let ?name = ?name::Name -> f Name
    Name -> f Name
    f in t -> f t
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    t -> f t
    traverseNamesIP

    mapNames :: (TraverseNames t) => (Name -> Name) -> t -> t
    mapNames :: forall t. TraverseNames t => (Name -> Name) -> t -> t
    mapNames Name -> Name
    f t
    x = t
    result
      where
      Identity t
    result = let ?name = Name -> Identity Name
    forall a. a -> Identity a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Name -> Identity Name) -> (Name -> Name) -> Name -> Identity Name
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Name -> Name
    f
                        in t -> Identity t
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    t -> f t
    traverseNamesIP t
    x

    class TraverseNames t where
      traverseNamesIP :: (Applicative f, ?name :: Name -> f Name) => t -> f t

    instance TraverseNames a => TraverseNames [a] where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    [a] -> f [a]
    traverseNamesIP = (a -> f a) -> [a] -> f [a]
    forall (t :: * -> *) (f :: * -> *) a b.
    (Traversable t, Applicative f) =>
    (a -> f b) -> t a -> f (t b)
    forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> [a] -> f [b]
    traverse a -> f a
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    a -> f a
    traverseNamesIP

    instance TraverseNames a => TraverseNames (Maybe a) where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Maybe a -> f (Maybe a)
    traverseNamesIP = (a -> f a) -> Maybe a -> f (Maybe a)
    forall (t :: * -> *) (f :: * -> *) a b.
    (Traversable t, Applicative f) =>
    (a -> f b) -> t a -> f (t b)
    forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Maybe a -> f (Maybe b)
    traverse a -> f a
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    a -> f a
    traverseNamesIP

    instance (Ord a, TraverseNames a) => TraverseNames (Set a) where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Set a -> f (Set a)
    traverseNamesIP = ([a] -> Set a) -> f [a] -> f (Set a)
    forall a b. (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap [a] -> Set a
    forall a. Ord a => [a] -> Set a
    Set.fromList (f [a] -> f (Set a)) -> (Set a -> f [a]) -> Set a -> f (Set a)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [a] -> f [a]
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    [a] -> f [a]
    traverseNamesIP ([a] -> f [a]) -> (Set a -> [a]) -> Set a -> f [a]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Set a -> [a]
    forall a. Set a -> [a]
    Set.toList

    instance TraverseNames a => TraverseNames (Located a) where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Located a -> f (Located a)
    traverseNamesIP (Located Range
    r a
    a) = Range -> a -> Located a
    forall a. Range -> a -> Located a
    Located Range
    r (a -> Located a) -> f a -> f (Located a)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> a -> f a
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    a -> f a
    traverseNamesIP a
    a

    instance TraverseNames Name where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP = ?name::Name -> f Name
    Name -> f Name
    ?name

    instance (Ord a, TraverseNames a) => TraverseNames (ExportSpec a) where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    ExportSpec a -> f (ExportSpec a)
    traverseNamesIP (ExportSpec Map Namespace (Set a)
    mp) = Map Namespace (Set a) -> ExportSpec a
    forall name. Map Namespace (Set name) -> ExportSpec name
    ExportSpec (Map Namespace (Set a) -> ExportSpec a)
    -> f (Map Namespace (Set a)) -> f (ExportSpec a)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> (Set a -> f (Set a))
    -> Map Namespace (Set a) -> f (Map Namespace (Set a))
    forall (t :: * -> *) (f :: * -> *) a b.
    (Traversable t, Applicative f) =>
    (a -> f b) -> t a -> f (t b)
    forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Map Namespace a -> f (Map Namespace b)
    traverse Set a -> f (Set a)
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Set a -> f (Set a)
    traverseNamesIP Map Namespace (Set a)
    mp

    instance TraverseNames Expr where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Expr -> f Expr
    traverseNamesIP Expr
    expr =
        case Expr
    expr of
          EList [Expr]
    es Type
    t        -> [Expr] -> Type -> Expr
    EList  ([Expr] -> Type -> Expr) -> f [Expr] -> f (Type -> Expr)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> [Expr] -> f [Expr]
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    [Expr] -> f [Expr]
    traverseNamesIP [Expr]
    es f (Type -> Expr) -> f Type -> f Expr
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Type -> f Type
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Type -> f Type
    traverseNamesIP Type
    t

          ETuple [Expr]
    es         -> [Expr] -> Expr
    ETuple ([Expr] -> Expr) -> f [Expr] -> f Expr
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> [Expr] -> f [Expr]
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    [Expr] -> f [Expr]
    traverseNamesIP [Expr]
    es

          ERec RecordMap Ident Expr
    mp           -> RecordMap Ident Expr -> Expr
    ERec (RecordMap Ident Expr -> Expr)
    -> f (RecordMap Ident Expr) -> f Expr
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> (Ident -> Expr -> f Expr)
    -> RecordMap Ident Expr -> f (RecordMap Ident Expr)
    forall (t :: * -> *) a b c.
    Applicative t =>
    (a -> b -> t c) -> RecordMap a b -> t (RecordMap a c)
    traverseRecordMap (\Ident
    _ -> Expr -> f Expr
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Expr -> f Expr
    traverseNamesIP) RecordMap Ident Expr
    mp

          ESel Expr
    e Selector
    l          -> (Expr -> Selector -> Expr
    `ESel` Selector
    l) (Expr -> Expr) -> f Expr -> f Expr
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Expr -> f Expr
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Expr -> f Expr
    traverseNamesIP Expr
    e

          ESet Type
    t Expr
    e1 Selector
    l Expr
    e2    -> Type -> Expr -> Selector -> Expr -> Expr
    ESet (Type -> Expr -> Selector -> Expr -> Expr)
    -> f Type -> f (Expr -> Selector -> Expr -> Expr)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Type -> f Type
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Type -> f Type
    traverseNamesIP Type
    t
                                    f (Expr -> Selector -> Expr -> Expr)
    -> f Expr -> f (Selector -> Expr -> Expr)
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Expr -> f Expr
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Expr -> f Expr
    traverseNamesIP Expr
    e1
                                    f (Selector -> Expr -> Expr) -> f Selector -> f (Expr -> Expr)
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Selector -> f Selector
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Selector
    l
                                    f (Expr -> Expr) -> f Expr -> f Expr
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Expr -> f Expr
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Expr -> f Expr
    traverseNamesIP Expr
    e2

          EIf Expr
    e1 Expr
    e2 Expr
    e3      -> Expr -> Expr -> Expr -> Expr
    EIf (Expr -> Expr -> Expr -> Expr)
    -> f Expr -> f (Expr -> Expr -> Expr)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Expr -> f Expr
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Expr -> f Expr
    traverseNamesIP Expr
    e1
                                   f (Expr -> Expr -> Expr) -> f Expr -> f (Expr -> Expr)
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Expr -> f Expr
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Expr -> f Expr
    traverseNamesIP Expr
    e2
                                   f (Expr -> Expr) -> f Expr -> f Expr
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Expr -> f Expr
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Expr -> f Expr
    traverseNamesIP Expr
    e3

          EComp Type
    t1 Type
    t2 Expr
    e [[Match]]
    mss -> Type -> Type -> Expr -> [[Match]] -> Expr
    EComp (Type -> Type -> Expr -> [[Match]] -> Expr)
    -> f Type -> f (Type -> Expr -> [[Match]] -> Expr)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Type -> f Type
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Type -> f Type
    traverseNamesIP Type
    t1
                                     f (Type -> Expr -> [[Match]] -> Expr)
    -> f Type -> f (Expr -> [[Match]] -> Expr)
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Type -> f Type
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Type -> f Type
    traverseNamesIP Type
    t2
                                     f (Expr -> [[Match]] -> Expr) -> f Expr -> f ([[Match]] -> Expr)
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Expr -> f Expr
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Expr -> f Expr
    traverseNamesIP Expr
    e
                                     f ([[Match]] -> Expr) -> f [[Match]] -> f Expr
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> [[Match]] -> f [[Match]]
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    [[Match]] -> f [[Match]]
    traverseNamesIP [[Match]]
    mss

          EVar Name
    x            -> Name -> Expr
    EVar (Name -> Expr) -> f Name -> f Expr
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP Name
    x
          ETAbs TParam
    tp Expr
    e        -> TParam -> Expr -> Expr
    ETAbs (TParam -> Expr -> Expr) -> f TParam -> f (Expr -> Expr)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> TParam -> f TParam
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    TParam -> f TParam
    traverseNamesIP TParam
    tp f (Expr -> Expr) -> f Expr -> f Expr
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Expr -> f Expr
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Expr -> f Expr
    traverseNamesIP Expr
    e
          ETApp Expr
    e Type
    t         -> Expr -> Type -> Expr
    ETApp (Expr -> Type -> Expr) -> f Expr -> f (Type -> Expr)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Expr -> f Expr
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Expr -> f Expr
    traverseNamesIP Expr
    e f (Type -> Expr) -> f Type -> f Expr
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Type -> f Type
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Type -> f Type
    traverseNamesIP Type
    t
          EApp Expr
    e1 Expr
    e2        -> Expr -> Expr -> Expr
    EApp (Expr -> Expr -> Expr) -> f Expr -> f (Expr -> Expr)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Expr -> f Expr
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Expr -> f Expr
    traverseNamesIP Expr
    e1 f (Expr -> Expr) -> f Expr -> f Expr
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Expr -> f Expr
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Expr -> f Expr
    traverseNamesIP Expr
    e2
          EAbs Name
    x Type
    t Expr
    e        -> Name -> Type -> Expr -> Expr
    EAbs (Name -> Type -> Expr -> Expr)
    -> f Name -> f (Type -> Expr -> Expr)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP Name
    x
                                    f (Type -> Expr -> Expr) -> f Type -> f (Expr -> Expr)
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Type -> f Type
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Type -> f Type
    traverseNamesIP Type
    t
                                    f (Expr -> Expr) -> f Expr -> f Expr
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Expr -> f Expr
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Expr -> f Expr
    traverseNamesIP Expr
    e
          ELocated Range
    r Expr
    e      -> Range -> Expr -> Expr
    ELocated Range
    r (Expr -> Expr) -> f Expr -> f Expr
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Expr -> f Expr
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Expr -> f Expr
    traverseNamesIP Expr
    e
          EProofAbs Type
    p Expr
    e     -> Type -> Expr -> Expr
    EProofAbs (Type -> Expr -> Expr) -> f Type -> f (Expr -> Expr)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Type -> f Type
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Type -> f Type
    traverseNamesIP Type
    p f (Expr -> Expr) -> f Expr -> f Expr
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Expr -> f Expr
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Expr -> f Expr
    traverseNamesIP Expr
    e
          EProofApp Expr
    e       -> Expr -> Expr
    EProofApp (Expr -> Expr) -> f Expr -> f Expr
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Expr -> f Expr
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Expr -> f Expr
    traverseNamesIP Expr
    e
          EWhere Expr
    e [DeclGroup]
    ds       -> Expr -> [DeclGroup] -> Expr
    EWhere (Expr -> [DeclGroup] -> Expr) -> f Expr -> f ([DeclGroup] -> Expr)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Expr -> f Expr
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Expr -> f Expr
    traverseNamesIP Expr
    e f ([DeclGroup] -> Expr) -> f [DeclGroup] -> f Expr
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> [DeclGroup] -> f [DeclGroup]
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    [DeclGroup] -> f [DeclGroup]
    traverseNamesIP [DeclGroup]
    ds

          EPropGuards [([Type], Expr)]
    gs Type
    t  -> [([Type], Expr)] -> Type -> Expr
    EPropGuards ([([Type], Expr)] -> Type -> Expr)
    -> f [([Type], Expr)] -> f (Type -> Expr)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> (([Type], Expr) -> f ([Type], Expr))
    -> [([Type], Expr)] -> f [([Type], Expr)]
    forall (t :: * -> *) (f :: * -> *) a b.
    (Traversable t, Applicative f) =>
    (a -> f b) -> t a -> f (t b)
    forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> [a] -> f [b]
    traverse ([Type], Expr) -> f ([Type], Expr)
    forall {f :: * -> *} {a} {a}.
    (Applicative f, ?name::Name -> f Name, TraverseNames a,
     TraverseNames a) =>
    (a, a) -> f (a, a)
    doG [([Type], Expr)]
    gs f (Type -> Expr) -> f Type -> f Expr
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Type -> f Type
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Type -> f Type
    traverseNamesIP Type
    t
            where doG :: (a, a) -> f (a, a)
    doG (a
    xs, a
    e) = (,) (a -> a -> (a, a)) -> f a -> f (a -> (a, a))
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> a -> f a
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    a -> f a
    traverseNamesIP a
    xs f (a -> (a, a)) -> f a -> f (a, a)
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> a -> f a
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    a -> f a
    traverseNamesIP a
    e

    instance TraverseNames Match where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Match -> f Match
    traverseNamesIP Match
    mat =
        case Match
    mat of
          From Name
    x Type
    t1 Type
    t2 Expr
    e -> Name -> Type -> Type -> Expr -> Match
    From (Name -> Type -> Type -> Expr -> Match)
    -> f Name -> f (Type -> Type -> Expr -> Match)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP Name
    x
                                 f (Type -> Type -> Expr -> Match)
    -> f Type -> f (Type -> Expr -> Match)
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Type -> f Type
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Type -> f Type
    traverseNamesIP Type
    t1
                                 f (Type -> Expr -> Match) -> f Type -> f (Expr -> Match)
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Type -> f Type
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Type -> f Type
    traverseNamesIP Type
    t2
                                 f (Expr -> Match) -> f Expr -> f Match
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Expr -> f Expr
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Expr -> f Expr
    traverseNamesIP Expr
    e
          Let Decl
    d          -> Decl -> Match
    Let (Decl -> Match) -> f Decl -> f Match
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Decl -> f Decl
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Decl -> f Decl
    traverseNamesIP Decl
    d

    instance TraverseNames DeclGroup where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    DeclGroup -> f DeclGroup
    traverseNamesIP DeclGroup
    dg =
        case DeclGroup
    dg of
          NonRecursive Decl
    d -> Decl -> DeclGroup
    NonRecursive (Decl -> DeclGroup) -> f Decl -> f DeclGroup
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Decl -> f Decl
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Decl -> f Decl
    traverseNamesIP Decl
    d
          Recursive [Decl]
    ds   -> [Decl] -> DeclGroup
    Recursive    ([Decl] -> DeclGroup) -> f [Decl] -> f DeclGroup
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> [Decl] -> f [Decl]
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    [Decl] -> f [Decl]
    traverseNamesIP [Decl]
    ds

    instance TraverseNames Decl where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Decl -> f Decl
    traverseNamesIP Decl
    decl = Name -> Schema -> DeclDef -> Decl
    mk (Name -> Schema -> DeclDef -> Decl)
    -> f Name -> f (Schema -> DeclDef -> Decl)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP (Decl -> Name
    dName Decl
    decl)
                                f (Schema -> DeclDef -> Decl) -> f Schema -> f (DeclDef -> Decl)
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Schema -> f Schema
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Schema -> f Schema
    traverseNamesIP (Decl -> Schema
    dSignature Decl
    decl)
                                f (DeclDef -> Decl) -> f DeclDef -> f Decl
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> DeclDef -> f DeclDef
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    DeclDef -> f DeclDef
    traverseNamesIP (Decl -> DeclDef
    dDefinition Decl
    decl)
        where mk :: Name -> Schema -> DeclDef -> Decl
    mk Name
    nm Schema
    sig DeclDef
    def = Decl
    decl { dName :: Name
    dName = Name
    nm
                                   , dSignature :: Schema
    dSignature = Schema
    sig
                                   , dDefinition :: DeclDef
    dDefinition = DeclDef
    def
                                   }

    instance TraverseNames DeclDef where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    DeclDef -> f DeclDef
    traverseNamesIP DeclDef
    d =
        case DeclDef
    d of
          DeclDef
    DPrim   -> DeclDef -> f DeclDef
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure DeclDef
    d
          DForeign FFIFunType
    t -> FFIFunType -> DeclDef
    DForeign (FFIFunType -> DeclDef) -> f FFIFunType -> f DeclDef
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> FFIFunType -> f FFIFunType
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    FFIFunType -> f FFIFunType
    traverseNamesIP FFIFunType
    t
          DExpr Expr
    e -> Expr -> DeclDef
    DExpr (Expr -> DeclDef) -> f Expr -> f DeclDef
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Expr -> f Expr
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Expr -> f Expr
    traverseNamesIP Expr
    e

    instance TraverseNames Schema where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Schema -> f Schema
    traverseNamesIP (Forall [TParam]
    as [Type]
    ps Type
    t) =
        [TParam] -> [Type] -> Type -> Schema
    Forall ([TParam] -> [Type] -> Type -> Schema)
    -> f [TParam] -> f ([Type] -> Type -> Schema)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> [TParam] -> f [TParam]
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    [TParam] -> f [TParam]
    traverseNamesIP [TParam]
    as
               f ([Type] -> Type -> Schema) -> f [Type] -> f (Type -> Schema)
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> [Type] -> f [Type]
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    [Type] -> f [Type]
    traverseNamesIP [Type]
    ps
               f (Type -> Schema) -> f Type -> f Schema
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Type -> f Type
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Type -> f Type
    traverseNamesIP Type
    t

    instance TraverseNames TParam where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    TParam -> f TParam
    traverseNamesIP TParam
    tp = TPFlavor -> TVarInfo -> TParam
    mk (TPFlavor -> TVarInfo -> TParam)
    -> f TPFlavor -> f (TVarInfo -> TParam)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> TPFlavor -> f TPFlavor
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    TPFlavor -> f TPFlavor
    traverseNamesIP (TParam -> TPFlavor
    tpFlav TParam
    tp)
                              f (TVarInfo -> TParam) -> f TVarInfo -> f TParam
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> TVarInfo -> f TVarInfo
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    TVarInfo -> f TVarInfo
    traverseNamesIP (TParam -> TVarInfo
    tpInfo TParam
    tp)
        -- XXX: module parameters should probably be represented directly
        -- as (abstract) user-defined types, rather than type variables.
        where mk :: TPFlavor -> TVarInfo -> TParam
    mk TPFlavor
    f TVarInfo
    i = case TPFlavor
    f of
                         TPModParam Name
    x ->
                          TParam
    tp { tpUnique :: Int
    tpUnique = Name -> Int
    nameUnique Name
    x, tpFlav :: TPFlavor
    tpFlav = TPFlavor
    f, tpInfo :: TVarInfo
    tpInfo = TVarInfo
    i }
                         TPFlavor
    _ -> TParam
    tp { tpFlav :: TPFlavor
    tpFlav = TPFlavor
    f, tpInfo :: TVarInfo
    tpInfo = TVarInfo
    i }

    instance TraverseNames TPFlavor where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    TPFlavor -> f TPFlavor
    traverseNamesIP TPFlavor
    tpf =
        case TPFlavor
    tpf of
          TPModParam Name
    x      -> Name -> TPFlavor
    TPModParam     (Name -> TPFlavor) -> f Name -> f TPFlavor
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP Name
    x
          TPFlavor
    TPUnifyVar        -> TPFlavor -> f TPFlavor
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure TPFlavor
    tpf
          TPSchemaParam Name
    x   -> Name -> TPFlavor
    TPSchemaParam  (Name -> TPFlavor) -> f Name -> f TPFlavor
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP Name
    x
          TPTySynParam Name
    x    -> Name -> TPFlavor
    TPTySynParam   (Name -> TPFlavor) -> f Name -> f TPFlavor
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP Name
    x
          TPPropSynParam Name
    x  -> Name -> TPFlavor
    TPPropSynParam (Name -> TPFlavor) -> f Name -> f TPFlavor
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP Name
    x
          TPNewtypeParam Name
    x  -> Name -> TPFlavor
    TPNewtypeParam (Name -> TPFlavor) -> f Name -> f TPFlavor
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP Name
    x
          TPPrimParam Name
    x     -> Name -> TPFlavor
    TPPrimParam    (Name -> TPFlavor) -> f Name -> f TPFlavor
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP Name
    x

    instance TraverseNames TVarInfo where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    TVarInfo -> f TVarInfo
    traverseNamesIP (TVarInfo Range
    r TypeSource
    s) = Range -> TypeSource -> TVarInfo
    TVarInfo Range
    r (TypeSource -> TVarInfo) -> f TypeSource -> f TVarInfo
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> TypeSource -> f TypeSource
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    TypeSource -> f TypeSource
    traverseNamesIP TypeSource
    s

    instance TraverseNames TypeSource where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    TypeSource -> f TypeSource
    traverseNamesIP TypeSource
    src =
        case TypeSource
    src of
          TVFromModParam Name
    x            -> Name -> TypeSource
    TVFromModParam (Name -> TypeSource) -> f Name -> f TypeSource
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP Name
    x
          TVFromSignature Name
    x           -> Name -> TypeSource
    TVFromSignature (Name -> TypeSource) -> f Name -> f TypeSource
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP Name
    x
          TypeSource
    TypeWildCard                -> TypeSource -> f TypeSource
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure TypeSource
    src
          TypeOfRecordField {}        -> TypeSource -> f TypeSource
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure TypeSource
    src
          TypeOfTupleField {}         -> TypeSource -> f TypeSource
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure TypeSource
    src
          TypeSource
    TypeOfSeqElement            -> TypeSource -> f TypeSource
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure TypeSource
    src
          TypeSource
    LenOfSeq                    -> TypeSource -> f TypeSource
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure TypeSource
    src
          TypeParamInstNamed Name
    x Ident
    i      -> Name -> Ident -> TypeSource
    TypeParamInstNamed (Name -> Ident -> TypeSource) -> f Name -> f (Ident -> TypeSource)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP Name
    x
                                                            f (Ident -> TypeSource) -> f Ident -> f TypeSource
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Ident -> f Ident
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Ident
    i
          TypeParamInstPos   Name
    x Int
    i      -> Name -> Int -> TypeSource
    TypeParamInstPos   (Name -> Int -> TypeSource) -> f Name -> f (Int -> TypeSource)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP Name
    x
                                                            f (Int -> TypeSource) -> f Int -> f TypeSource
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Int -> f Int
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Int
    i
          DefinitionOf Name
    x              -> Name -> TypeSource
    DefinitionOf (Name -> TypeSource) -> f Name -> f TypeSource
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP Name
    x
          TypeSource
    LenOfCompGen                -> TypeSource -> f TypeSource
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure TypeSource
    src
          TypeOfArg ArgDescr
    arg               -> ArgDescr -> TypeSource
    TypeOfArg (ArgDescr -> TypeSource) -> f ArgDescr -> f TypeSource
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ArgDescr -> f ArgDescr
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    ArgDescr -> f ArgDescr
    traverseNamesIP ArgDescr
    arg
          TypeSource
    TypeOfRes                   -> TypeSource -> f TypeSource
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure TypeSource
    src
          TypeSource
    FunApp                      -> TypeSource -> f TypeSource
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure TypeSource
    src
          TypeSource
    TypeOfIfCondExpr            -> TypeSource -> f TypeSource
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure TypeSource
    src
          TypeSource
    TypeFromUserAnnotation      -> TypeSource -> f TypeSource
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure TypeSource
    src
          TypeSource
    GeneratorOfListComp         -> TypeSource -> f TypeSource
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure TypeSource
    src
          TypeSource
    TypeErrorPlaceHolder        -> TypeSource -> f TypeSource
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure TypeSource
    src

    instance TraverseNames ArgDescr where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    ArgDescr -> f ArgDescr
    traverseNamesIP ArgDescr
    arg = Maybe Name -> ArgDescr
    mk (Maybe Name -> ArgDescr) -> f (Maybe Name) -> f ArgDescr
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Maybe Name -> f (Maybe Name)
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Maybe Name -> f (Maybe Name)
    traverseNamesIP (ArgDescr -> Maybe Name
    argDescrFun ArgDescr
    arg)
        where mk :: Maybe Name -> ArgDescr
    mk Maybe Name
    n = ArgDescr
    arg { argDescrFun :: Maybe Name
    argDescrFun = Maybe Name
    n }

    instance TraverseNames Type where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Type -> f Type
    traverseNamesIP Type
    ty =
        case Type
    ty of
          TCon TCon
    tc [Type]
    ts    -> TCon -> [Type] -> Type
    TCon (TCon -> [Type] -> Type) -> f TCon -> f ([Type] -> Type)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> TCon -> f TCon
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    TCon -> f TCon
    traverseNamesIP TCon
    tc f ([Type] -> Type) -> f [Type] -> f Type
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> [Type] -> f [Type]
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    [Type] -> f [Type]
    traverseNamesIP [Type]
    ts
          TVar TVar
    x        -> TVar -> Type
    TVar (TVar -> Type) -> f TVar -> f Type
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> TVar -> f TVar
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    TVar -> f TVar
    traverseNamesIP TVar
    x
          TUser Name
    x [Type]
    ts Type
    t  -> Name -> [Type] -> Type -> Type
    TUser (Name -> [Type] -> Type -> Type)
    -> f Name -> f ([Type] -> Type -> Type)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP Name
    x
                                 f ([Type] -> Type -> Type) -> f [Type] -> f (Type -> Type)
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> [Type] -> f [Type]
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    [Type] -> f [Type]
    traverseNamesIP [Type]
    ts
                                 f (Type -> Type) -> f Type -> f Type
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Type -> f Type
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Type -> f Type
    traverseNamesIP Type
    t
          TRec RecordMap Ident Type
    rm       -> RecordMap Ident Type -> Type
    TRec (RecordMap Ident Type -> Type)
    -> f (RecordMap Ident Type) -> f Type
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> (Ident -> Type -> f Type)
    -> RecordMap Ident Type -> f (RecordMap Ident Type)
    forall (t :: * -> *) a b c.
    Applicative t =>
    (a -> b -> t c) -> RecordMap a b -> t (RecordMap a c)
    traverseRecordMap (\Ident
    _ -> Type -> f Type
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Type -> f Type
    traverseNamesIP) RecordMap Ident Type
    rm
          TNewtype Newtype
    nt [Type]
    ts -> Newtype -> [Type] -> Type
    TNewtype (Newtype -> [Type] -> Type) -> f Newtype -> f ([Type] -> Type)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Newtype -> f Newtype
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Newtype -> f Newtype
    traverseNamesIP Newtype
    nt f ([Type] -> Type) -> f [Type] -> f Type
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> [Type] -> f [Type]
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    [Type] -> f [Type]
    traverseNamesIP [Type]
    ts

    instance TraverseNames TCon where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    TCon -> f TCon
    traverseNamesIP TCon
    tcon =
        case TCon
    tcon of
          TC TC
    tc -> TC -> TCon
    TC (TC -> TCon) -> f TC -> f TCon
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> TC -> f TC
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    TC -> f TC
    traverseNamesIP TC
    tc
          TCon
    _     -> TCon -> f TCon
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure TCon
    tcon

    instance TraverseNames TC where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    TC -> f TC
    traverseNamesIP TC
    tc =
        case TC
    tc of
          TCAbstract UserTC
    ut -> UserTC -> TC
    TCAbstract (UserTC -> TC) -> f UserTC -> f TC
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> UserTC -> f UserTC
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    UserTC -> f UserTC
    traverseNamesIP UserTC
    ut
          TC
    _             -> TC -> f TC
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure TC
    tc

    instance TraverseNames UserTC where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    UserTC -> f UserTC
    traverseNamesIP (UserTC Name
    x Kind
    k) = Name -> Kind -> UserTC
    UserTC (Name -> Kind -> UserTC) -> f Name -> f (Kind -> UserTC)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP Name
    x f (Kind -> UserTC) -> f Kind -> f UserTC
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Kind -> f Kind
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Kind
    k

    instance TraverseNames TVar where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    TVar -> f TVar
    traverseNamesIP TVar
    tvar =
        case TVar
    tvar of
          TVFree Int
    x Kind
    k Set TParam
    ys TVarInfo
    i -> Int -> Kind -> Set TParam -> TVarInfo -> TVar
    TVFree Int
    x Kind
    k (Set TParam -> TVarInfo -> TVar)
    -> f (Set TParam) -> f (TVarInfo -> TVar)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Set TParam -> f (Set TParam)
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Set TParam -> f (Set TParam)
    traverseNamesIP Set TParam
    ys f (TVarInfo -> TVar) -> f TVarInfo -> f TVar
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> TVarInfo -> f TVarInfo
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    TVarInfo -> f TVarInfo
    traverseNamesIP TVarInfo
    i
          TVBound TParam
    x       -> TParam -> TVar
    TVBound (TParam -> TVar) -> f TParam -> f TVar
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> TParam -> f TParam
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    TParam -> f TParam
    traverseNamesIP TParam
    x

    instance TraverseNames Newtype where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Newtype -> f Newtype
    traverseNamesIP Newtype
    nt = Name
    -> [TParam] -> [Type] -> Name -> RecordMap Ident Type -> Newtype
    mk (Name
     -> [TParam] -> [Type] -> Name -> RecordMap Ident Type -> Newtype)
    -> f Name
    -> f ([TParam]
          -> [Type] -> Name -> RecordMap Ident Type -> Newtype)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP (Newtype -> Name
    ntName Newtype
    nt)
                              f ([TParam] -> [Type] -> Name -> RecordMap Ident Type -> Newtype)
    -> f [TParam]
    -> f ([Type] -> Name -> RecordMap Ident Type -> Newtype)
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> [TParam] -> f [TParam]
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    [TParam] -> f [TParam]
    traverseNamesIP (Newtype -> [TParam]
    ntParams Newtype
    nt)
                              f ([Type] -> Name -> RecordMap Ident Type -> Newtype)
    -> f [Type] -> f (Name -> RecordMap Ident Type -> Newtype)
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> [Type] -> f [Type]
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    [Type] -> f [Type]
    traverseNamesIP (Newtype -> [Type]
    ntConstraints Newtype
    nt)
                              f (Name -> RecordMap Ident Type -> Newtype)
    -> f Name -> f (RecordMap Ident Type -> Newtype)
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP (Newtype -> Name
    ntConName Newtype
    nt)
                              f (RecordMap Ident Type -> Newtype)
    -> f (RecordMap Ident Type) -> f Newtype
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> (Ident -> Type -> f Type)
    -> RecordMap Ident Type -> f (RecordMap Ident Type)
    forall (t :: * -> *) a b c.
    Applicative t =>
    (a -> b -> t c) -> RecordMap a b -> t (RecordMap a c)
    traverseRecordMap (\Ident
    _ -> Type -> f Type
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Type -> f Type
    traverseNamesIP)
                                                    (Newtype -> RecordMap Ident Type
    ntFields Newtype
    nt)
        where
        mk :: Name
    -> [TParam] -> [Type] -> Name -> RecordMap Ident Type -> Newtype
    mk Name
    a [TParam]
    b [Type]
    c Name
    d RecordMap Ident Type
    e = Newtype
    nt { ntName :: Name
    ntName = Name
    a
                          , ntParams :: [TParam]
    ntParams = [TParam]
    b
                          , ntConstraints :: [Type]
    ntConstraints = [Type]
    c
                          , ntConName :: Name
    ntConName = Name
    d
                          , ntFields :: RecordMap Ident Type
    ntFields = RecordMap Ident Type
    e
                          }

    instance TraverseNames ModTParam where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    ModTParam -> f ModTParam
    traverseNamesIP ModTParam
    nt = Name -> ModTParam
    mk (Name -> ModTParam) -> f Name -> f ModTParam
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP (ModTParam -> Name
    mtpName ModTParam
    nt)
        where
        mk :: Name -> ModTParam
    mk Name
    x = ModTParam
    nt { mtpName :: Name
    mtpName = Name
    x }

    instance TraverseNames ModVParam where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    ModVParam -> f ModVParam
    traverseNamesIP ModVParam
    nt = Name -> Schema -> ModVParam
    mk (Name -> Schema -> ModVParam) -> f Name -> f (Schema -> ModVParam)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP (ModVParam -> Name
    mvpName ModVParam
    nt)
                              f (Schema -> ModVParam) -> f Schema -> f ModVParam
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Schema -> f Schema
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Schema -> f Schema
    traverseNamesIP (ModVParam -> Schema
    mvpType ModVParam
    nt)
        where
        mk :: Name -> Schema -> ModVParam
    mk Name
    x Schema
    t = ModVParam
    nt { mvpName :: Name
    mvpName = Name
    x, mvpType :: Schema
    mvpType = Schema
    t }

    instance TraverseNames FFIFunType where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    FFIFunType -> f FFIFunType
    traverseNamesIP FFIFunType
    fi = [FFIType] -> FFIType -> FFIFunType
    mk ([FFIType] -> FFIType -> FFIFunType)
    -> f [FFIType] -> f (FFIType -> FFIFunType)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> [FFIType] -> f [FFIType]
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    [FFIType] -> f [FFIType]
    traverseNamesIP (FFIFunType -> [FFIType]
    ffiArgTypes FFIFunType
    fi)
                              f (FFIType -> FFIFunType) -> f FFIType -> f FFIFunType
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> FFIType -> f FFIType
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    FFIType -> f FFIType
    traverseNamesIP (FFIFunType -> FFIType
    ffiRetType FFIFunType
    fi)
        where
        mk :: [FFIType] -> FFIType -> FFIFunType
    mk [FFIType]
    as FFIType
    b =
          FFIFunType
            { ffiTParams :: [TParam]
    ffiTParams  = FFIFunType -> [TParam]
    ffiTParams FFIFunType
    fi
            , ffiArgTypes :: [FFIType]
    ffiArgTypes = [FFIType]
    as
            , ffiRetType :: FFIType
    ffiRetType  = FFIType
    b
            }

    instance TraverseNames FFIType where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    FFIType -> f FFIType
    traverseNamesIP FFIType
    ft =
        case FFIType
    ft of
          FFIType
    FFIBool       -> FFIType -> f FFIType
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure FFIType
    ft
          FFIBasic FFIBasicType
    _    -> FFIType -> f FFIType
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure FFIType
    ft   -- assumes no names here
          FFIArray [Type]
    sz FFIBasicType
    t -> ([Type] -> FFIBasicType -> FFIType
    `FFIArray` FFIBasicType
    t) ([Type] -> FFIType) -> f [Type] -> f FFIType
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> [Type] -> f [Type]
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    [Type] -> f [Type]
    traverseNamesIP [Type]
    sz
          FFITuple [FFIType]
    ts   -> [FFIType] -> FFIType
    FFITuple  ([FFIType] -> FFIType) -> f [FFIType] -> f FFIType
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> [FFIType] -> f [FFIType]
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    [FFIType] -> f [FFIType]
    traverseNamesIP [FFIType]
    ts
          FFIRecord RecordMap Ident FFIType
    mp  -> RecordMap Ident FFIType -> FFIType
    FFIRecord (RecordMap Ident FFIType -> FFIType)
    -> f (RecordMap Ident FFIType) -> f FFIType
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> (Ident -> FFIType -> f FFIType)
    -> RecordMap Ident FFIType -> f (RecordMap Ident FFIType)
    forall (t :: * -> *) a b c.
    Applicative t =>
    (a -> b -> t c) -> RecordMap a b -> t (RecordMap a c)
    traverseRecordMap
                                                    (\Ident
    _ -> FFIType -> f FFIType
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    FFIType -> f FFIType
    traverseNamesIP) RecordMap Ident FFIType
    mp
    instance TraverseNames TySyn where
      traverseNamesIP :: forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    TySyn -> f TySyn
    traverseNamesIP TySyn
    ts = Name -> [TParam] -> [Type] -> Type -> TySyn
    mk (Name -> [TParam] -> [Type] -> Type -> TySyn)
    -> f Name -> f ([TParam] -> [Type] -> Type -> TySyn)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Name -> f Name
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Name -> f Name
    traverseNamesIP (TySyn -> Name
    tsName TySyn
    ts)
                              f ([TParam] -> [Type] -> Type -> TySyn)
    -> f [TParam] -> f ([Type] -> Type -> TySyn)
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> [TParam] -> f [TParam]
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    [TParam] -> f [TParam]
    traverseNamesIP (TySyn -> [TParam]
    tsParams TySyn
    ts)
                              f ([Type] -> Type -> TySyn) -> f [Type] -> f (Type -> TySyn)
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> [Type] -> f [Type]
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    [Type] -> f [Type]
    traverseNamesIP (TySyn -> [Type]
    tsConstraints TySyn
    ts)
                              f (Type -> TySyn) -> f Type -> f TySyn
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Type -> f Type
    forall t (f :: * -> *).
    (TraverseNames t, Applicative f, ?name::Name -> f Name) =>
    t -> f t
    forall (f :: * -> *).
    (Applicative f, ?name::Name -> f Name) =>
    Type -> f Type
    traverseNamesIP (TySyn -> Type
    tsDef TySyn
    ts)
        where mk :: Name -> [TParam] -> [Type] -> Type -> TySyn
    mk Name
    n [TParam]
    ps [Type]
    cs Type
    t =
                TySyn  { tsName :: Name
    tsName        = Name
    n
                       , tsParams :: [TParam]
    tsParams      = [TParam]
    ps
                       , tsConstraints :: [Type]
    tsConstraints = [Type]
    cs
                       , tsDef :: Type
    tsDef         = Type
    t
                       , tsDoc :: Maybe Text
    tsDoc         = TySyn -> Maybe Text
    tsDoc TySyn
    ts
                       }