{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
module OTel.SDK.Resource.Core.Internal
  ( -- * Disclaimer
    -- $disclaimer
    Resource(..)
  , defaultResourceBuilder
  , forSpecificSchema
  , resourceBuilderFromAttrs

  , ResourceBuilder(..)
  , buildResource
  , buildResourcePure

  , ResourceMergeError(..)
  ) where

import Control.Exception.Safe (Exception, MonadThrow, throwM)
import Data.Aeson (ToJSON(..), (.=), object)
import Data.HashMap.Strict (HashMap)
import Data.Kind (Type)
import Data.Text (Text)
import OTel.API.Common
  ( AttrsFor(..), KV(..), Attrs, AttrsBuilder, SchemaURL, ToAttrVal, attrsLimitsCount
  , attrsLimitsValueLength, defaultAttrsLimits
  )
import OTel.API.Common.Internal (runAttrsBuilder)
import OTel.SDK.Resource.Core.Attributes (pattern RESOURCE_SCHEMA_URL, pattern SERVICE_NAME)
import Prelude
import qualified Data.HashMap.Strict as HashMap

data Resource (attrs :: AttrsFor -> Type) = Resource
  { forall (attrs :: AttrsFor -> *).
Resource attrs -> attrs 'AttrsForResource
resourceAttrs :: attrs 'AttrsForResource
  , forall (attrs :: AttrsFor -> *). Resource attrs -> Maybe SchemaURL
resourceSchemaURL :: Maybe SchemaURL
  }

deriving stock instance Eq (Resource Attrs)
deriving stock instance Show (Resource Attrs)

instance ToJSON (Resource Attrs) where
  toJSON :: Resource Attrs -> Value
toJSON Resource Attrs
resource =
    [Pair] -> Value
object
      [ Key
"attributes" Key -> Attrs 'AttrsForResource -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Attrs 'AttrsForResource
resourceAttrs
      , Key
"schemaURL" Key -> Maybe SchemaURL -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe SchemaURL
resourceSchemaURL
      ]
    where
    Resource { Attrs 'AttrsForResource
resourceAttrs :: forall (attrs :: AttrsFor -> *).
Resource attrs -> attrs 'AttrsForResource
resourceAttrs :: Attrs 'AttrsForResource
resourceAttrs, Maybe SchemaURL
resourceSchemaURL :: forall (attrs :: AttrsFor -> *). Resource attrs -> Maybe SchemaURL
resourceSchemaURL :: Maybe SchemaURL
resourceSchemaURL } = Resource Attrs
resource

defaultResourceBuilder :: Text -> ResourceBuilder
defaultResourceBuilder :: Text -> ResourceBuilder
defaultResourceBuilder Text
serviceName =
  SchemaURL -> ResourceBuilder -> ResourceBuilder
forSpecificSchema SchemaURL
RESOURCE_SCHEMA_URL (ResourceBuilder -> ResourceBuilder)
-> ResourceBuilder -> ResourceBuilder
forall a b. (a -> b) -> a -> b
$
    Key Text
SERVICE_NAME Key Text -> Text -> ResourceBuilder
forall kv from to.
(KV kv, KVConstraints kv from to) =>
Key to -> from -> kv
forall from to.
KVConstraints ResourceBuilder from to =>
Key to -> from -> ResourceBuilder
.@ Text
serviceName

forSpecificSchema :: SchemaURL -> ResourceBuilder -> ResourceBuilder
forSpecificSchema :: SchemaURL -> ResourceBuilder -> ResourceBuilder
forSpecificSchema SchemaURL
schemaURL ResourceBuilder
resourceBuilder =
  case ResourceBuilder
-> Either
     (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
     (Resource AttrsBuilder)
unResourceBuilder ResourceBuilder
resourceBuilder of
    Left {} -> ResourceBuilder
resourceBuilder
    Right Resource AttrsBuilder
resource ->
      Either
  (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
  (Resource AttrsBuilder)
-> ResourceBuilder
ResourceBuilder (Either
   (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
   (Resource AttrsBuilder)
 -> ResourceBuilder)
-> Either
     (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
     (Resource AttrsBuilder)
-> ResourceBuilder
forall a b. (a -> b) -> a -> b
$ Resource AttrsBuilder
-> Either
     (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
     (Resource AttrsBuilder)
forall a b. b -> Either a b
Right Resource AttrsBuilder
resource { resourceSchemaURL = Just schemaURL }

resourceBuilderFromAttrs :: AttrsBuilder 'AttrsForResource -> ResourceBuilder
resourceBuilderFromAttrs :: AttrsBuilder 'AttrsForResource -> ResourceBuilder
resourceBuilderFromAttrs AttrsBuilder 'AttrsForResource
resourceAttrs =
  Either
  (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
  (Resource AttrsBuilder)
-> ResourceBuilder
ResourceBuilder (Either
   (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
   (Resource AttrsBuilder)
 -> ResourceBuilder)
-> Either
     (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
     (Resource AttrsBuilder)
-> ResourceBuilder
forall a b. (a -> b) -> a -> b
$ Resource AttrsBuilder
-> Either
     (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
     (Resource AttrsBuilder)
forall a b. b -> Either a b
Right Resource
    { AttrsBuilder 'AttrsForResource
resourceAttrs :: AttrsBuilder 'AttrsForResource
resourceAttrs :: AttrsBuilder 'AttrsForResource
resourceAttrs
    , resourceSchemaURL :: Maybe SchemaURL
resourceSchemaURL = Maybe SchemaURL
forall a. Maybe a
Nothing
    }

newtype ResourceBuilder = ResourceBuilder
  { ResourceBuilder
-> Either
     (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
     (Resource AttrsBuilder)
unResourceBuilder
      :: Either
           (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
           (Resource AttrsBuilder)
  }

instance KV ResourceBuilder where
  type KVConstraints ResourceBuilder = ToAttrVal
  Key to
k .@ :: forall from to.
KVConstraints ResourceBuilder from to =>
Key to -> from -> ResourceBuilder
.@ from
v = AttrsBuilder 'AttrsForResource -> ResourceBuilder
resourceBuilderFromAttrs (AttrsBuilder 'AttrsForResource -> ResourceBuilder)
-> AttrsBuilder 'AttrsForResource -> ResourceBuilder
forall a b. (a -> b) -> a -> b
$ Key to
k Key to -> from -> AttrsBuilder 'AttrsForResource
forall kv from to.
(KV kv, KVConstraints kv from to) =>
Key to -> from -> kv
forall from to.
KVConstraints (AttrsBuilder 'AttrsForResource) from to =>
Key to -> from -> AttrsBuilder 'AttrsForResource
.@ from
v

instance Semigroup ResourceBuilder where
  ResourceBuilder
rb1 <> :: ResourceBuilder -> ResourceBuilder -> ResourceBuilder
<> ResourceBuilder
rb2 =
    case (ResourceBuilder
-> Either
     (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
     (Resource AttrsBuilder)
unResourceBuilder ResourceBuilder
rb1, ResourceBuilder
-> Either
     (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
     (Resource AttrsBuilder)
unResourceBuilder ResourceBuilder
rb2) of
      (Left HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
e1, Left HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
e2) -> Either
  (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
  (Resource AttrsBuilder)
-> ResourceBuilder
ResourceBuilder (Either
   (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
   (Resource AttrsBuilder)
 -> ResourceBuilder)
-> Either
     (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
     (Resource AttrsBuilder)
-> ResourceBuilder
forall a b. (a -> b) -> a -> b
$ HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
-> Either
     (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
     (Resource AttrsBuilder)
forall a b. a -> Either a b
Left (HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
 -> Either
      (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
      (Resource AttrsBuilder))
-> HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
-> Either
     (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
     (Resource AttrsBuilder)
forall a b. (a -> b) -> a -> b
$ HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
-> HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
-> HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
unionAppendAttrs HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
e1 HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
e2
      (Left HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
e1, Right {}) -> Either
  (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
  (Resource AttrsBuilder)
-> ResourceBuilder
ResourceBuilder (Either
   (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
   (Resource AttrsBuilder)
 -> ResourceBuilder)
-> Either
     (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
     (Resource AttrsBuilder)
-> ResourceBuilder
forall a b. (a -> b) -> a -> b
$ HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
-> Either
     (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
     (Resource AttrsBuilder)
forall a b. a -> Either a b
Left HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
e1
      (Right {}, Left HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
e2) -> Either
  (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
  (Resource AttrsBuilder)
-> ResourceBuilder
ResourceBuilder (Either
   (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
   (Resource AttrsBuilder)
 -> ResourceBuilder)
-> Either
     (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
     (Resource AttrsBuilder)
-> ResourceBuilder
forall a b. (a -> b) -> a -> b
$ HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
-> Either
     (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
     (Resource AttrsBuilder)
forall a b. a -> Either a b
Left HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
e2
      (Right Resource AttrsBuilder
r1, Right Resource AttrsBuilder
r2)
        | Maybe SchemaURL
Nothing <- Maybe SchemaURL
schema1 -> Maybe SchemaURL -> ResourceBuilder
res Maybe SchemaURL
schema2
        | Maybe SchemaURL
Nothing <- Maybe SchemaURL
schema2 -> Maybe SchemaURL -> ResourceBuilder
res Maybe SchemaURL
schema1
        | Just SchemaURL
s1 <- Maybe SchemaURL
schema1, Just SchemaURL
s2 <- Maybe SchemaURL
schema2, SchemaURL
s1 SchemaURL -> SchemaURL -> Bool
forall a. Eq a => a -> a -> Bool
== SchemaURL
s2 -> Maybe SchemaURL -> ResourceBuilder
res Maybe SchemaURL
schema1
        | Just SchemaURL
s1 <- Maybe SchemaURL
schema1, Just SchemaURL
s2 <- Maybe SchemaURL
schema2 ->
            Either
  (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
  (Resource AttrsBuilder)
-> ResourceBuilder
ResourceBuilder
              (Either
   (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
   (Resource AttrsBuilder)
 -> ResourceBuilder)
-> Either
     (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
     (Resource AttrsBuilder)
-> ResourceBuilder
forall a b. (a -> b) -> a -> b
$ HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
-> Either
     (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
     (Resource AttrsBuilder)
forall a b. a -> Either a b
Left
              (HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
 -> Either
      (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
      (Resource AttrsBuilder))
-> HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
-> Either
     (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
     (Resource AttrsBuilder)
forall a b. (a -> b) -> a -> b
$ HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
-> HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
-> HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
unionAppendAttrs
                  (SchemaURL
-> AttrsBuilder 'AttrsForResource
-> HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
forall k v. Hashable k => k -> v -> HashMap k v
HashMap.singleton SchemaURL
s1 (AttrsBuilder 'AttrsForResource
 -> HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
-> AttrsBuilder 'AttrsForResource
-> HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
forall a b. (a -> b) -> a -> b
$ Resource AttrsBuilder -> AttrsBuilder 'AttrsForResource
forall (attrs :: AttrsFor -> *).
Resource attrs -> attrs 'AttrsForResource
resourceAttrs Resource AttrsBuilder
r1)
                  (SchemaURL
-> AttrsBuilder 'AttrsForResource
-> HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
forall k v. Hashable k => k -> v -> HashMap k v
HashMap.singleton SchemaURL
s2 (AttrsBuilder 'AttrsForResource
 -> HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
-> AttrsBuilder 'AttrsForResource
-> HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
forall a b. (a -> b) -> a -> b
$ Resource AttrsBuilder -> AttrsBuilder 'AttrsForResource
forall (attrs :: AttrsFor -> *).
Resource attrs -> attrs 'AttrsForResource
resourceAttrs Resource AttrsBuilder
r2)
        where
        res :: Maybe SchemaURL -> ResourceBuilder
res Maybe SchemaURL
schemaURL =
          Either
  (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
  (Resource AttrsBuilder)
-> ResourceBuilder
ResourceBuilder (Either
   (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
   (Resource AttrsBuilder)
 -> ResourceBuilder)
-> Either
     (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
     (Resource AttrsBuilder)
-> ResourceBuilder
forall a b. (a -> b) -> a -> b
$ Resource AttrsBuilder
-> Either
     (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
     (Resource AttrsBuilder)
forall a b. b -> Either a b
Right Resource
            { resourceAttrs :: AttrsBuilder 'AttrsForResource
resourceAttrs = AttrsBuilder 'AttrsForResource
attrs1 AttrsBuilder 'AttrsForResource
-> AttrsBuilder 'AttrsForResource -> AttrsBuilder 'AttrsForResource
forall a. Semigroup a => a -> a -> a
<> AttrsBuilder 'AttrsForResource
attrs2
            , resourceSchemaURL :: Maybe SchemaURL
resourceSchemaURL = Maybe SchemaURL
schemaURL
            }
        Resource { resourceAttrs :: forall (attrs :: AttrsFor -> *).
Resource attrs -> attrs 'AttrsForResource
resourceAttrs = AttrsBuilder 'AttrsForResource
attrs1 , resourceSchemaURL :: forall (attrs :: AttrsFor -> *). Resource attrs -> Maybe SchemaURL
resourceSchemaURL = Maybe SchemaURL
schema1 } = Resource AttrsBuilder
r1
        Resource { resourceAttrs :: forall (attrs :: AttrsFor -> *).
Resource attrs -> attrs 'AttrsForResource
resourceAttrs = AttrsBuilder 'AttrsForResource
attrs2 , resourceSchemaURL :: forall (attrs :: AttrsFor -> *). Resource attrs -> Maybe SchemaURL
resourceSchemaURL = Maybe SchemaURL
schema2 } = Resource AttrsBuilder
r2
    where
    unionAppendAttrs :: HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
-> HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
-> HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
unionAppendAttrs = (AttrsBuilder 'AttrsForResource
 -> AttrsBuilder 'AttrsForResource
 -> AttrsBuilder 'AttrsForResource)
-> HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
-> HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
-> HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
forall k v.
(Eq k, Hashable k) =>
(v -> v -> v) -> HashMap k v -> HashMap k v -> HashMap k v
HashMap.unionWith AttrsBuilder 'AttrsForResource
-> AttrsBuilder 'AttrsForResource -> AttrsBuilder 'AttrsForResource
forall a. Semigroup a => a -> a -> a
(<>)

instance Monoid ResourceBuilder where
  mempty :: ResourceBuilder
mempty = AttrsBuilder 'AttrsForResource -> ResourceBuilder
resourceBuilderFromAttrs AttrsBuilder 'AttrsForResource
forall a. Monoid a => a
mempty

buildResource
  :: forall m
   . (MonadThrow m)
  => ResourceBuilder
  -> m (Resource Attrs)
buildResource :: forall (m :: * -> *).
MonadThrow m =>
ResourceBuilder -> m (Resource Attrs)
buildResource ResourceBuilder
resourceBuilder =
  case ResourceBuilder -> Either ResourceMergeError (Resource Attrs)
buildResourcePure ResourceBuilder
resourceBuilder of
    Left ResourceMergeError
err -> ResourceMergeError -> m (Resource Attrs)
forall (m :: * -> *) e a.
(HasCallStack, MonadThrow m, Exception e) =>
e -> m a
throwM ResourceMergeError
err
    Right Resource Attrs
x -> Resource Attrs -> m (Resource Attrs)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Resource Attrs
x

buildResourcePure
  :: ResourceBuilder
  -> Either ResourceMergeError (Resource Attrs)
buildResourcePure :: ResourceBuilder -> Either ResourceMergeError (Resource Attrs)
buildResourcePure ResourceBuilder
resourceBuilder =
  case ResourceBuilder
-> Either
     (HashMap SchemaURL (AttrsBuilder 'AttrsForResource))
     (Resource AttrsBuilder)
unResourceBuilder ResourceBuilder
resourceBuilder of
    Left HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
hashMap -> ResourceMergeError -> Either ResourceMergeError (Resource Attrs)
forall a b. a -> Either a b
Left (ResourceMergeError -> Either ResourceMergeError (Resource Attrs))
-> ResourceMergeError -> Either ResourceMergeError (Resource Attrs)
forall a b. (a -> b) -> a -> b
$ ResourceMergeError
      { resourceMergeErrorSchemas :: HashMap SchemaURL (Attrs 'AttrsForResource)
resourceMergeErrorSchemas = (AttrsBuilder 'AttrsForResource -> Attrs 'AttrsForResource)
-> HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
-> HashMap SchemaURL (Attrs 'AttrsForResource)
forall a b. (a -> b) -> HashMap SchemaURL a -> HashMap SchemaURL b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap AttrsBuilder 'AttrsForResource -> Attrs 'AttrsForResource
forall {af :: AttrsFor}. AttrsBuilder af -> Attrs af
build HashMap SchemaURL (AttrsBuilder 'AttrsForResource)
hashMap
      }
    Right Resource AttrsBuilder
resource -> Resource Attrs -> Either ResourceMergeError (Resource Attrs)
forall a b. b -> Either a b
Right (Resource Attrs -> Either ResourceMergeError (Resource Attrs))
-> Resource Attrs -> Either ResourceMergeError (Resource Attrs)
forall a b. (a -> b) -> a -> b
$ Resource AttrsBuilder -> Resource Attrs
go Resource AttrsBuilder
resource
  where
  go :: Resource AttrsBuilder -> Resource Attrs
go Resource AttrsBuilder
resource = Resource AttrsBuilder
resource { resourceAttrs = build $ resourceAttrs resource }

  build :: AttrsBuilder af -> Attrs af
build AttrsBuilder af
attrs =
    AttrsBuilder af -> AttrsLimits af -> Attrs af
forall (af :: AttrsFor).
AttrsBuilder af -> AttrsLimits af -> Attrs af
runAttrsBuilder AttrsBuilder af
attrs AttrsLimits Any
forall (af :: AttrsFor). AttrsLimits af
defaultAttrsLimits
      { attrsLimitsCount = Nothing
      , attrsLimitsValueLength = Nothing
      }

newtype ResourceMergeError = ResourceMergeError
  { ResourceMergeError -> HashMap SchemaURL (Attrs 'AttrsForResource)
resourceMergeErrorSchemas :: HashMap SchemaURL (Attrs 'AttrsForResource)
  } deriving stock (ResourceMergeError -> ResourceMergeError -> Bool
(ResourceMergeError -> ResourceMergeError -> Bool)
-> (ResourceMergeError -> ResourceMergeError -> Bool)
-> Eq ResourceMergeError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ResourceMergeError -> ResourceMergeError -> Bool
== :: ResourceMergeError -> ResourceMergeError -> Bool
$c/= :: ResourceMergeError -> ResourceMergeError -> Bool
/= :: ResourceMergeError -> ResourceMergeError -> Bool
Eq, Int -> ResourceMergeError -> ShowS
[ResourceMergeError] -> ShowS
ResourceMergeError -> String
(Int -> ResourceMergeError -> ShowS)
-> (ResourceMergeError -> String)
-> ([ResourceMergeError] -> ShowS)
-> Show ResourceMergeError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ResourceMergeError -> ShowS
showsPrec :: Int -> ResourceMergeError -> ShowS
$cshow :: ResourceMergeError -> String
show :: ResourceMergeError -> String
$cshowList :: [ResourceMergeError] -> ShowS
showList :: [ResourceMergeError] -> ShowS
Show)
    deriving anyclass (Show ResourceMergeError
Typeable ResourceMergeError
(Typeable ResourceMergeError, Show ResourceMergeError) =>
(ResourceMergeError -> SomeException)
-> (SomeException -> Maybe ResourceMergeError)
-> (ResourceMergeError -> String)
-> Exception ResourceMergeError
SomeException -> Maybe ResourceMergeError
ResourceMergeError -> String
ResourceMergeError -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e) -> (e -> String) -> Exception e
$ctoException :: ResourceMergeError -> SomeException
toException :: ResourceMergeError -> SomeException
$cfromException :: SomeException -> Maybe ResourceMergeError
fromException :: SomeException -> Maybe ResourceMergeError
$cdisplayException :: ResourceMergeError -> String
displayException :: ResourceMergeError -> String
Exception)

-- $disclaimer
--
-- In general, changes to this module will not be reflected in the library's
-- version updates. Direct use of this module should be done with utmost care,
-- otherwise invariants will easily be violated.