{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE OverloadedLists #-}

module Hasura.RQL.Types.Webhook.Transform.Class
  ( Template (..),
    TemplatingEngine (..),
    TransformFn,
    TransformCtx,
    TransformErrorBundle (..),
    UnescapedTemplate (..),
  )
where

import Autodocodec (HasCodec (codec), dimapCodec, stringConstCodec)
import Data.Aeson (FromJSON, FromJSONKey, ToJSON, ToJSONKey)
import Data.Aeson qualified as J
import Data.Kind (Type)
import Hasura.Prelude

-- | Textual transformation template.
newtype Template = Template
  { Template -> Text
unTemplate :: Text
  }
  deriving stock (Template -> Template -> Bool
(Template -> Template -> Bool)
-> (Template -> Template -> Bool) -> Eq Template
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Template -> Template -> Bool
== :: Template -> Template -> Bool
$c/= :: Template -> Template -> Bool
/= :: Template -> Template -> Bool
Eq, (forall x. Template -> Rep Template x)
-> (forall x. Rep Template x -> Template) -> Generic Template
forall x. Rep Template x -> Template
forall x. Template -> Rep Template x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Template -> Rep Template x
from :: forall x. Template -> Rep Template x
$cto :: forall x. Rep Template x -> Template
to :: forall x. Rep Template x -> Template
Generic, Eq Template
Eq Template
-> (Template -> Template -> Ordering)
-> (Template -> Template -> Bool)
-> (Template -> Template -> Bool)
-> (Template -> Template -> Bool)
-> (Template -> Template -> Bool)
-> (Template -> Template -> Template)
-> (Template -> Template -> Template)
-> Ord Template
Template -> Template -> Bool
Template -> Template -> Ordering
Template -> Template -> Template
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Template -> Template -> Ordering
compare :: Template -> Template -> Ordering
$c< :: Template -> Template -> Bool
< :: Template -> Template -> Bool
$c<= :: Template -> Template -> Bool
<= :: Template -> Template -> Bool
$c> :: Template -> Template -> Bool
> :: Template -> Template -> Bool
$c>= :: Template -> Template -> Bool
>= :: Template -> Template -> Bool
$cmax :: Template -> Template -> Template
max :: Template -> Template -> Template
$cmin :: Template -> Template -> Template
min :: Template -> Template -> Template
Ord, Int -> Template -> ShowS
[Template] -> ShowS
Template -> String
(Int -> Template -> ShowS)
-> (Template -> String) -> ([Template] -> ShowS) -> Show Template
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Template -> ShowS
showsPrec :: Int -> Template -> ShowS
$cshow :: Template -> String
show :: Template -> String
$cshowList :: [Template] -> ShowS
showList :: [Template] -> ShowS
Show)
  deriving newtype (Eq Template
Eq Template
-> (Int -> Template -> Int)
-> (Template -> Int)
-> Hashable Template
Int -> Template -> Int
Template -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> Template -> Int
hashWithSalt :: Int -> Template -> Int
$chash :: Template -> Int
hash :: Template -> Int
Hashable, FromJSONKeyFunction [Template]
FromJSONKeyFunction Template
FromJSONKeyFunction Template
-> FromJSONKeyFunction [Template] -> FromJSONKey Template
forall a.
FromJSONKeyFunction a -> FromJSONKeyFunction [a] -> FromJSONKey a
$cfromJSONKey :: FromJSONKeyFunction Template
fromJSONKey :: FromJSONKeyFunction Template
$cfromJSONKeyList :: FromJSONKeyFunction [Template]
fromJSONKeyList :: FromJSONKeyFunction [Template]
FromJSONKey, ToJSONKeyFunction [Template]
ToJSONKeyFunction Template
ToJSONKeyFunction Template
-> ToJSONKeyFunction [Template] -> ToJSONKey Template
forall a.
ToJSONKeyFunction a -> ToJSONKeyFunction [a] -> ToJSONKey a
$ctoJSONKey :: ToJSONKeyFunction Template
toJSONKey :: ToJSONKeyFunction Template
$ctoJSONKeyList :: ToJSONKeyFunction [Template]
toJSONKeyList :: ToJSONKeyFunction [Template]
ToJSONKey)
  deriving anyclass (Template -> ()
(Template -> ()) -> NFData Template
forall a. (a -> ()) -> NFData a
$crnf :: Template -> ()
rnf :: Template -> ()
NFData)

instance HasCodec Template where
  codec :: JSONCodec Template
codec = (Text -> Template)
-> (Template -> Text)
-> Codec Value Text Text
-> JSONCodec Template
forall oldOutput newOutput newInput oldInput context.
(oldOutput -> newOutput)
-> (newInput -> oldInput)
-> Codec context oldInput oldOutput
-> Codec context newInput newOutput
dimapCodec Text -> Template
Template Template -> Text
unTemplate Codec Value Text Text
forall value. HasCodec value => JSONCodec value
codec

instance J.FromJSON Template where
  parseJSON :: Value -> Parser Template
parseJSON = String -> (Text -> Parser Template) -> Value -> Parser Template
forall a. String -> (Text -> Parser a) -> Value -> Parser a
J.withText String
"Template" (Template -> Parser Template
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Template -> Parser Template)
-> (Text -> Template) -> Text -> Parser Template
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Template
Template)

instance J.ToJSON Template where
  toJSON :: Template -> Value
toJSON = Text -> Value
J.String (Text -> Value) -> (Template -> Text) -> Template -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Template -> Text
forall a b. Coercible a b => a -> b
coerce

-- | Validated textual transformation template /for string
-- interpolation only/.
--
-- This is necessary due to Kriti not distinguishing between string
-- literals and string templates.
newtype UnescapedTemplate = UnescapedTemplate
  { UnescapedTemplate -> Text
getUnescapedTemplate :: Text
  }
  deriving stock (UnescapedTemplate -> UnescapedTemplate -> Bool
(UnescapedTemplate -> UnescapedTemplate -> Bool)
-> (UnescapedTemplate -> UnescapedTemplate -> Bool)
-> Eq UnescapedTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UnescapedTemplate -> UnescapedTemplate -> Bool
== :: UnescapedTemplate -> UnescapedTemplate -> Bool
$c/= :: UnescapedTemplate -> UnescapedTemplate -> Bool
/= :: UnescapedTemplate -> UnescapedTemplate -> Bool
Eq, (forall x. UnescapedTemplate -> Rep UnescapedTemplate x)
-> (forall x. Rep UnescapedTemplate x -> UnescapedTemplate)
-> Generic UnescapedTemplate
forall x. Rep UnescapedTemplate x -> UnescapedTemplate
forall x. UnescapedTemplate -> Rep UnescapedTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. UnescapedTemplate -> Rep UnescapedTemplate x
from :: forall x. UnescapedTemplate -> Rep UnescapedTemplate x
$cto :: forall x. Rep UnescapedTemplate x -> UnescapedTemplate
to :: forall x. Rep UnescapedTemplate x -> UnescapedTemplate
Generic, Eq UnescapedTemplate
Eq UnescapedTemplate
-> (UnescapedTemplate -> UnescapedTemplate -> Ordering)
-> (UnescapedTemplate -> UnescapedTemplate -> Bool)
-> (UnescapedTemplate -> UnescapedTemplate -> Bool)
-> (UnescapedTemplate -> UnescapedTemplate -> Bool)
-> (UnescapedTemplate -> UnescapedTemplate -> Bool)
-> (UnescapedTemplate -> UnescapedTemplate -> UnescapedTemplate)
-> (UnescapedTemplate -> UnescapedTemplate -> UnescapedTemplate)
-> Ord UnescapedTemplate
UnescapedTemplate -> UnescapedTemplate -> Bool
UnescapedTemplate -> UnescapedTemplate -> Ordering
UnescapedTemplate -> UnescapedTemplate -> UnescapedTemplate
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: UnescapedTemplate -> UnescapedTemplate -> Ordering
compare :: UnescapedTemplate -> UnescapedTemplate -> Ordering
$c< :: UnescapedTemplate -> UnescapedTemplate -> Bool
< :: UnescapedTemplate -> UnescapedTemplate -> Bool
$c<= :: UnescapedTemplate -> UnescapedTemplate -> Bool
<= :: UnescapedTemplate -> UnescapedTemplate -> Bool
$c> :: UnescapedTemplate -> UnescapedTemplate -> Bool
> :: UnescapedTemplate -> UnescapedTemplate -> Bool
$c>= :: UnescapedTemplate -> UnescapedTemplate -> Bool
>= :: UnescapedTemplate -> UnescapedTemplate -> Bool
$cmax :: UnescapedTemplate -> UnescapedTemplate -> UnescapedTemplate
max :: UnescapedTemplate -> UnescapedTemplate -> UnescapedTemplate
$cmin :: UnescapedTemplate -> UnescapedTemplate -> UnescapedTemplate
min :: UnescapedTemplate -> UnescapedTemplate -> UnescapedTemplate
Ord, Int -> UnescapedTemplate -> ShowS
[UnescapedTemplate] -> ShowS
UnescapedTemplate -> String
(Int -> UnescapedTemplate -> ShowS)
-> (UnescapedTemplate -> String)
-> ([UnescapedTemplate] -> ShowS)
-> Show UnescapedTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UnescapedTemplate -> ShowS
showsPrec :: Int -> UnescapedTemplate -> ShowS
$cshow :: UnescapedTemplate -> String
show :: UnescapedTemplate -> String
$cshowList :: [UnescapedTemplate] -> ShowS
showList :: [UnescapedTemplate] -> ShowS
Show)
  deriving newtype (Eq UnescapedTemplate
Eq UnescapedTemplate
-> (Int -> UnescapedTemplate -> Int)
-> (UnescapedTemplate -> Int)
-> Hashable UnescapedTemplate
Int -> UnescapedTemplate -> Int
UnescapedTemplate -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> UnescapedTemplate -> Int
hashWithSalt :: Int -> UnescapedTemplate -> Int
$chash :: UnescapedTemplate -> Int
hash :: UnescapedTemplate -> Int
Hashable, FromJSONKeyFunction [UnescapedTemplate]
FromJSONKeyFunction UnescapedTemplate
FromJSONKeyFunction UnescapedTemplate
-> FromJSONKeyFunction [UnescapedTemplate]
-> FromJSONKey UnescapedTemplate
forall a.
FromJSONKeyFunction a -> FromJSONKeyFunction [a] -> FromJSONKey a
$cfromJSONKey :: FromJSONKeyFunction UnescapedTemplate
fromJSONKey :: FromJSONKeyFunction UnescapedTemplate
$cfromJSONKeyList :: FromJSONKeyFunction [UnescapedTemplate]
fromJSONKeyList :: FromJSONKeyFunction [UnescapedTemplate]
FromJSONKey, ToJSONKeyFunction [UnescapedTemplate]
ToJSONKeyFunction UnescapedTemplate
ToJSONKeyFunction UnescapedTemplate
-> ToJSONKeyFunction [UnescapedTemplate]
-> ToJSONKey UnescapedTemplate
forall a.
ToJSONKeyFunction a -> ToJSONKeyFunction [a] -> ToJSONKey a
$ctoJSONKey :: ToJSONKeyFunction UnescapedTemplate
toJSONKey :: ToJSONKeyFunction UnescapedTemplate
$ctoJSONKeyList :: ToJSONKeyFunction [UnescapedTemplate]
toJSONKeyList :: ToJSONKeyFunction [UnescapedTemplate]
ToJSONKey)
  deriving anyclass (UnescapedTemplate -> ()
(UnescapedTemplate -> ()) -> NFData UnescapedTemplate
forall a. (a -> ()) -> NFData a
$crnf :: UnescapedTemplate -> ()
rnf :: UnescapedTemplate -> ()
NFData)

instance HasCodec UnescapedTemplate where
  codec :: JSONCodec UnescapedTemplate
codec = (Text -> UnescapedTemplate)
-> (UnescapedTemplate -> Text)
-> Codec Value Text Text
-> JSONCodec UnescapedTemplate
forall oldOutput newOutput newInput oldInput context.
(oldOutput -> newOutput)
-> (newInput -> oldInput)
-> Codec context oldInput oldOutput
-> Codec context newInput newOutput
dimapCodec Text -> UnescapedTemplate
UnescapedTemplate UnescapedTemplate -> Text
getUnescapedTemplate Codec Value Text Text
forall value. HasCodec value => JSONCodec value
codec

instance J.FromJSON UnescapedTemplate where
  parseJSON :: Value -> Parser UnescapedTemplate
parseJSON = String
-> (Text -> Parser UnescapedTemplate)
-> Value
-> Parser UnescapedTemplate
forall a. String -> (Text -> Parser a) -> Value -> Parser a
J.withText String
"Template" (UnescapedTemplate -> Parser UnescapedTemplate
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (UnescapedTemplate -> Parser UnescapedTemplate)
-> (Text -> UnescapedTemplate) -> Text -> Parser UnescapedTemplate
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> UnescapedTemplate
UnescapedTemplate)

instance J.ToJSON UnescapedTemplate where
  toJSON :: UnescapedTemplate -> Value
toJSON = Text -> Value
J.String (Text -> Value)
-> (UnescapedTemplate -> Text) -> UnescapedTemplate -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UnescapedTemplate -> Text
forall a b. Coercible a b => a -> b
coerce

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

-- | Available templating engines.
data TemplatingEngine
  = Kriti
  deriving stock (TemplatingEngine
TemplatingEngine -> TemplatingEngine -> Bounded TemplatingEngine
forall a. a -> a -> Bounded a
$cminBound :: TemplatingEngine
minBound :: TemplatingEngine
$cmaxBound :: TemplatingEngine
maxBound :: TemplatingEngine
Bounded, Int -> TemplatingEngine
TemplatingEngine -> Int
TemplatingEngine -> [TemplatingEngine]
TemplatingEngine -> TemplatingEngine
TemplatingEngine -> TemplatingEngine -> [TemplatingEngine]
TemplatingEngine
-> TemplatingEngine -> TemplatingEngine -> [TemplatingEngine]
(TemplatingEngine -> TemplatingEngine)
-> (TemplatingEngine -> TemplatingEngine)
-> (Int -> TemplatingEngine)
-> (TemplatingEngine -> Int)
-> (TemplatingEngine -> [TemplatingEngine])
-> (TemplatingEngine -> TemplatingEngine -> [TemplatingEngine])
-> (TemplatingEngine -> TemplatingEngine -> [TemplatingEngine])
-> (TemplatingEngine
    -> TemplatingEngine -> TemplatingEngine -> [TemplatingEngine])
-> Enum TemplatingEngine
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: TemplatingEngine -> TemplatingEngine
succ :: TemplatingEngine -> TemplatingEngine
$cpred :: TemplatingEngine -> TemplatingEngine
pred :: TemplatingEngine -> TemplatingEngine
$ctoEnum :: Int -> TemplatingEngine
toEnum :: Int -> TemplatingEngine
$cfromEnum :: TemplatingEngine -> Int
fromEnum :: TemplatingEngine -> Int
$cenumFrom :: TemplatingEngine -> [TemplatingEngine]
enumFrom :: TemplatingEngine -> [TemplatingEngine]
$cenumFromThen :: TemplatingEngine -> TemplatingEngine -> [TemplatingEngine]
enumFromThen :: TemplatingEngine -> TemplatingEngine -> [TemplatingEngine]
$cenumFromTo :: TemplatingEngine -> TemplatingEngine -> [TemplatingEngine]
enumFromTo :: TemplatingEngine -> TemplatingEngine -> [TemplatingEngine]
$cenumFromThenTo :: TemplatingEngine
-> TemplatingEngine -> TemplatingEngine -> [TemplatingEngine]
enumFromThenTo :: TemplatingEngine
-> TemplatingEngine -> TemplatingEngine -> [TemplatingEngine]
Enum, TemplatingEngine -> TemplatingEngine -> Bool
(TemplatingEngine -> TemplatingEngine -> Bool)
-> (TemplatingEngine -> TemplatingEngine -> Bool)
-> Eq TemplatingEngine
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TemplatingEngine -> TemplatingEngine -> Bool
== :: TemplatingEngine -> TemplatingEngine -> Bool
$c/= :: TemplatingEngine -> TemplatingEngine -> Bool
/= :: TemplatingEngine -> TemplatingEngine -> Bool
Eq, (forall x. TemplatingEngine -> Rep TemplatingEngine x)
-> (forall x. Rep TemplatingEngine x -> TemplatingEngine)
-> Generic TemplatingEngine
forall x. Rep TemplatingEngine x -> TemplatingEngine
forall x. TemplatingEngine -> Rep TemplatingEngine x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TemplatingEngine -> Rep TemplatingEngine x
from :: forall x. TemplatingEngine -> Rep TemplatingEngine x
$cto :: forall x. Rep TemplatingEngine x -> TemplatingEngine
to :: forall x. Rep TemplatingEngine x -> TemplatingEngine
Generic, Int -> TemplatingEngine -> ShowS
[TemplatingEngine] -> ShowS
TemplatingEngine -> String
(Int -> TemplatingEngine -> ShowS)
-> (TemplatingEngine -> String)
-> ([TemplatingEngine] -> ShowS)
-> Show TemplatingEngine
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TemplatingEngine -> ShowS
showsPrec :: Int -> TemplatingEngine -> ShowS
$cshow :: TemplatingEngine -> String
show :: TemplatingEngine -> String
$cshowList :: [TemplatingEngine] -> ShowS
showList :: [TemplatingEngine] -> ShowS
Show)
  deriving anyclass (TemplatingEngine -> ()
(TemplatingEngine -> ()) -> NFData TemplatingEngine
forall a. (a -> ()) -> NFData a
$crnf :: TemplatingEngine -> ()
rnf :: TemplatingEngine -> ()
NFData)

instance HasCodec TemplatingEngine where
  codec :: JSONCodec TemplatingEngine
codec = NonEmpty (TemplatingEngine, Text) -> JSONCodec TemplatingEngine
forall constant.
Eq constant =>
NonEmpty (constant, Text) -> JSONCodec constant
stringConstCodec [(TemplatingEngine
Kriti, Text
"Kriti")]

-- XXX(jkachmar): We need roundtrip tests for these instances.
instance FromJSON TemplatingEngine where
  parseJSON :: Value -> Parser TemplatingEngine
parseJSON =
    Options -> Value -> Parser TemplatingEngine
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
J.genericParseJSON
      Options
J.defaultOptions
        { tagSingleConstructors :: Bool
J.tagSingleConstructors = Bool
True
        }

-- XXX(jkachmar): We need roundtrip tests for these instances.
instance ToJSON TemplatingEngine where
  toJSON :: TemplatingEngine -> Value
toJSON =
    Options -> TemplatingEngine -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
J.genericToJSON
      Options
J.defaultOptions
        { tagSingleConstructors :: Bool
J.tagSingleConstructors = Bool
True
        }

  toEncoding :: TemplatingEngine -> Encoding
toEncoding =
    Options -> TemplatingEngine -> Encoding
forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
J.genericToEncoding
      Options
J.defaultOptions
        { tagSingleConstructors :: Bool
J.tagSingleConstructors = Bool
True
        }

-- | The associated type 'TransformFn a' is the defunctionalized version
-- of some transformation that should be applied to a given request field.
--
-- In most cases it is some variation on a piece of template text describing
-- the transformation.
data family TransformFn a :: Type

data family TransformCtx a :: Type

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

-- | We use collect all transformation failures as a '[J.Value]'.
newtype TransformErrorBundle = TransformErrorBundle
  { TransformErrorBundle -> [Value]
tebMessages :: [J.Value]
  }
  deriving stock (TransformErrorBundle -> TransformErrorBundle -> Bool
(TransformErrorBundle -> TransformErrorBundle -> Bool)
-> (TransformErrorBundle -> TransformErrorBundle -> Bool)
-> Eq TransformErrorBundle
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TransformErrorBundle -> TransformErrorBundle -> Bool
== :: TransformErrorBundle -> TransformErrorBundle -> Bool
$c/= :: TransformErrorBundle -> TransformErrorBundle -> Bool
/= :: TransformErrorBundle -> TransformErrorBundle -> Bool
Eq, (forall x. TransformErrorBundle -> Rep TransformErrorBundle x)
-> (forall x. Rep TransformErrorBundle x -> TransformErrorBundle)
-> Generic TransformErrorBundle
forall x. Rep TransformErrorBundle x -> TransformErrorBundle
forall x. TransformErrorBundle -> Rep TransformErrorBundle x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TransformErrorBundle -> Rep TransformErrorBundle x
from :: forall x. TransformErrorBundle -> Rep TransformErrorBundle x
$cto :: forall x. Rep TransformErrorBundle x -> TransformErrorBundle
to :: forall x. Rep TransformErrorBundle x -> TransformErrorBundle
Generic, Int -> TransformErrorBundle -> ShowS
[TransformErrorBundle] -> ShowS
TransformErrorBundle -> String
(Int -> TransformErrorBundle -> ShowS)
-> (TransformErrorBundle -> String)
-> ([TransformErrorBundle] -> ShowS)
-> Show TransformErrorBundle
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TransformErrorBundle -> ShowS
showsPrec :: Int -> TransformErrorBundle -> ShowS
$cshow :: TransformErrorBundle -> String
show :: TransformErrorBundle -> String
$cshowList :: [TransformErrorBundle] -> ShowS
showList :: [TransformErrorBundle] -> ShowS
Show)
  deriving newtype (Semigroup TransformErrorBundle
TransformErrorBundle
Semigroup TransformErrorBundle
-> TransformErrorBundle
-> (TransformErrorBundle
    -> TransformErrorBundle -> TransformErrorBundle)
-> ([TransformErrorBundle] -> TransformErrorBundle)
-> Monoid TransformErrorBundle
[TransformErrorBundle] -> TransformErrorBundle
TransformErrorBundle
-> TransformErrorBundle -> TransformErrorBundle
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
$cmempty :: TransformErrorBundle
mempty :: TransformErrorBundle
$cmappend :: TransformErrorBundle
-> TransformErrorBundle -> TransformErrorBundle
mappend :: TransformErrorBundle
-> TransformErrorBundle -> TransformErrorBundle
$cmconcat :: [TransformErrorBundle] -> TransformErrorBundle
mconcat :: [TransformErrorBundle] -> TransformErrorBundle
Monoid, NonEmpty TransformErrorBundle -> TransformErrorBundle
TransformErrorBundle
-> TransformErrorBundle -> TransformErrorBundle
(TransformErrorBundle
 -> TransformErrorBundle -> TransformErrorBundle)
-> (NonEmpty TransformErrorBundle -> TransformErrorBundle)
-> (forall b.
    Integral b =>
    b -> TransformErrorBundle -> TransformErrorBundle)
-> Semigroup TransformErrorBundle
forall b.
Integral b =>
b -> TransformErrorBundle -> TransformErrorBundle
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
$c<> :: TransformErrorBundle
-> TransformErrorBundle -> TransformErrorBundle
<> :: TransformErrorBundle
-> TransformErrorBundle -> TransformErrorBundle
$csconcat :: NonEmpty TransformErrorBundle -> TransformErrorBundle
sconcat :: NonEmpty TransformErrorBundle -> TransformErrorBundle
$cstimes :: forall b.
Integral b =>
b -> TransformErrorBundle -> TransformErrorBundle
stimes :: forall b.
Integral b =>
b -> TransformErrorBundle -> TransformErrorBundle
Semigroup, Value -> Parser [TransformErrorBundle]
Value -> Parser TransformErrorBundle
(Value -> Parser TransformErrorBundle)
-> (Value -> Parser [TransformErrorBundle])
-> FromJSON TransformErrorBundle
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
$cparseJSON :: Value -> Parser TransformErrorBundle
parseJSON :: Value -> Parser TransformErrorBundle
$cparseJSONList :: Value -> Parser [TransformErrorBundle]
parseJSONList :: Value -> Parser [TransformErrorBundle]
FromJSON, [TransformErrorBundle] -> Value
[TransformErrorBundle] -> Encoding
TransformErrorBundle -> Value
TransformErrorBundle -> Encoding
(TransformErrorBundle -> Value)
-> (TransformErrorBundle -> Encoding)
-> ([TransformErrorBundle] -> Value)
-> ([TransformErrorBundle] -> Encoding)
-> ToJSON TransformErrorBundle
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: TransformErrorBundle -> Value
toJSON :: TransformErrorBundle -> Value
$ctoEncoding :: TransformErrorBundle -> Encoding
toEncoding :: TransformErrorBundle -> Encoding
$ctoJSONList :: [TransformErrorBundle] -> Value
toJSONList :: [TransformErrorBundle] -> Value
$ctoEncodingList :: [TransformErrorBundle] -> Encoding
toEncodingList :: [TransformErrorBundle] -> Encoding
ToJSON)
  deriving anyclass (TransformErrorBundle -> ()
(TransformErrorBundle -> ()) -> NFData TransformErrorBundle
forall a. (a -> ()) -> NFData a
$crnf :: TransformErrorBundle -> ()
rnf :: TransformErrorBundle -> ()
NFData)