    {-# LANGUAGE DeriveFunctor      #-}
    {-# LANGUAGE StandaloneDeriving #-}

    {-# OPTIONS_GHC -Wno-orphans #-}

    module Dhall.Syntax.Instances.Functor () where

    import                Dhall.Syntax.Binding
    import                Dhall.Syntax.Chunks
    import                Dhall.Syntax.Expr
    import                Dhall.Syntax.FunctionBinding
    import {-# SOURCE #-} Dhall.Syntax.Operations      (unsafeSubExpressions)
    import                Dhall.Syntax.RecordField
    import                Dhall.Syntax.Types

    import qualified Lens.Micro as Lens

    deriving instance Functor (Binding s)
    deriving instance Functor (Chunks s)
    deriving instance Functor (RecordField s)
    deriving instance Functor (FunctionBinding s)
    deriving instance Functor FieldSelection

    -- This instance is hand-written due to the fact that deriving
    -- it does not give us an INLINABLE pragma. We annotate this fmap
    -- implementation with this pragma below to allow GHC to, possibly,
    -- inline the implementation for performance improvements.
    instance Functor (Expr s) where
      fmap :: forall a b. (a -> b) -> Expr s a -> Expr s b
    fmap a -> b
    f (Embed a
    a) = b -> Expr s b
    forall s a. a -> Expr s a
    Embed (a -> b
    f a
    a)
      fmap a -> b
    f (Let Binding s a
    b Expr s a
    e2) = Binding s b -> Expr s b -> Expr s b
    forall s a. Binding s a -> Expr s a -> Expr s a
    Let ((a -> b) -> Binding s a -> Binding s b
    forall a b. (a -> b) -> Binding s a -> Binding s b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap a -> b
    f Binding s a
    b) ((a -> b) -> Expr s a -> Expr s b
    forall a b. (a -> b) -> Expr s a -> Expr s b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap a -> b
    f Expr s a
    e2)
      fmap a -> b
    f (Note s
    s Expr s a
    e1) = s -> Expr s b -> Expr s b
    forall s a. s -> Expr s a -> Expr s a
    Note s
    s ((a -> b) -> Expr s a -> Expr s b
    forall a b. (a -> b) -> Expr s a -> Expr s b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap a -> b
    f Expr s a
    e1)
      fmap a -> b
    f (Record Map Text (RecordField s a)
    a) = Map Text (RecordField s b) -> Expr s b
    forall s a. Map Text (RecordField s a) -> Expr s a
    Record (Map Text (RecordField s b) -> Expr s b)
    -> Map Text (RecordField s b) -> Expr s b
    forall a b. (a -> b) -> a -> b
    $ (a -> b) -> RecordField s a -> RecordField s b
    forall a b. (a -> b) -> RecordField s a -> RecordField s b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap a -> b
    f (RecordField s a -> RecordField s b)
    -> Map Text (RecordField s a) -> Map Text (RecordField s b)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Map Text (RecordField s a)
    a
      fmap a -> b
    f (RecordLit Map Text (RecordField s a)
    a) = Map Text (RecordField s b) -> Expr s b
    forall s a. Map Text (RecordField s a) -> Expr s a
    RecordLit (Map Text (RecordField s b) -> Expr s b)
    -> Map Text (RecordField s b) -> Expr s b
    forall a b. (a -> b) -> a -> b
    $ (a -> b) -> RecordField s a -> RecordField s b
    forall a b. (a -> b) -> RecordField s a -> RecordField s b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap a -> b
    f (RecordField s a -> RecordField s b)
    -> Map Text (RecordField s a) -> Map Text (RecordField s b)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Map Text (RecordField s a)
    a
      fmap a -> b
    f (Lam Maybe CharacterSet
    cs FunctionBinding s a
    fb Expr s a
    e) = Maybe CharacterSet -> FunctionBinding s b -> Expr s b -> Expr s b
    forall s a.
    Maybe CharacterSet -> FunctionBinding s a -> Expr s a -> Expr s a
    Lam Maybe CharacterSet
    cs (a -> b
    f (a -> b) -> FunctionBinding s a -> FunctionBinding s b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> FunctionBinding s a
    fb) (a -> b
    f (a -> b) -> Expr s a -> Expr s b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Expr s a
    e)
      fmap a -> b
    f (Field Expr s a
    a FieldSelection s
    b) = Expr s b -> FieldSelection s -> Expr s b
    forall s a. Expr s a -> FieldSelection s -> Expr s a
    Field (a -> b
    f (a -> b) -> Expr s a -> Expr s b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Expr s a
    a) FieldSelection s
    b
      fmap a -> b
    f Expr s a
    expression = ASetter (Expr s a) (Expr s b) (Expr s a) (Expr s b)
    -> (Expr s a -> Expr s b) -> Expr s a -> Expr s b
    forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
    Lens.over ASetter (Expr s a) (Expr s b) (Expr s a) (Expr s b)
    forall (f :: * -> *) s a t b.
    Applicative f =>
    (Expr s a -> f (Expr t b)) -> Expr s a -> f (Expr t b)
    unsafeSubExpressions ((a -> b) -> Expr s a -> Expr s b
    forall a b. (a -> b) -> Expr s a -> Expr s b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap a -> b
    f) Expr s a
    expression
      {-# INLINABLE fmap #-}