{-# 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.Family 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
instance Functor (Expr s) where
fmap :: forall a b. (a -> b) -> Expr s a -> Expr s b
fmap a -> b
f (Embed a
a) = 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) = forall s a. Binding s a -> Expr s a -> Expr s a
Let (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f Binding s a
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) = forall s a. s -> Expr s a -> Expr s a
Note s
s (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) = forall s a. Map Text (RecordField s a) -> Expr s a
Record forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f 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) = forall s a. Map Text (RecordField s a) -> Expr s a
RecordLit forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f 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) = forall s a.
Maybe CharacterSet -> FunctionBinding s a -> Expr s a -> Expr s a
Lam Maybe CharacterSet
cs (a -> b
f forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FunctionBinding s a
fb) (a -> b
f 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) = forall s a. Expr s a -> FieldSelection s -> Expr s a
Field (a -> b
f 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 = forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
Lens.over forall (f :: * -> *) s a t b.
Applicative f =>
(Expr s a -> f (Expr t b)) -> Expr s a -> f (Expr t b)
unsafeSubExpressions (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f) Expr s a
expression
{-# INLINABLE fmap #-}