module Hasql.Codecs.RequestingOid ( RequestingOid, toUnknownTypes, toBase, requestAndHandle, lift, hoist, lookup, lookingUp, hoistLookingUp, ) where import Data.HashMap.Strict qualified as HashMap import Hasql.Codecs.RequestingOid.LookingUp qualified as LookingUp import Hasql.Platform.Prelude hiding (lift, lookup) type RequestingOid = LookingUp.LookingUp (Maybe Text, Text) (Word32, Word32) toUnknownTypes :: RequestingOid f a -> HashSet (Maybe Text, Text) toUnknownTypes :: forall (f :: * -> *) a. RequestingOid f a -> HashSet (Maybe Text, Text) toUnknownTypes (LookingUp.LookingUp [(Maybe Text, Text)] unknownTypes ((Maybe Text, Text) -> (Word32, Word32)) -> f a _) = [Item (HashSet (Maybe Text, Text))] -> HashSet (Maybe Text, Text) forall l. IsList l => [Item l] -> l fromList [(Maybe Text, Text)] [Item (HashSet (Maybe Text, Text))] unknownTypes toBase :: RequestingOid f a -> HashMap (Maybe Text, Text) (Word32, Word32) -> f a toBase :: forall (f :: * -> *) a. RequestingOid f a -> HashMap (Maybe Text, Text) (Word32, Word32) -> f a toBase (LookingUp.LookingUp [(Maybe Text, Text)] _unknownTypes ((Maybe Text, Text) -> (Word32, Word32)) -> f a decoder) HashMap (Maybe Text, Text) (Word32, Word32) oidCache = ((Maybe Text, Text) -> (Word32, Word32)) -> f a decoder \(Maybe Text, Text) key -> (Maybe Text, Text) -> HashMap (Maybe Text, Text) (Word32, Word32) -> Maybe (Word32, Word32) forall k v. (Eq k, Hashable k) => k -> HashMap k v -> Maybe v HashMap.lookup (Maybe Text, Text) key HashMap (Maybe Text, Text) (Word32, Word32) oidCache Maybe (Word32, Word32) -> (Maybe (Word32, Word32) -> (Word32, Word32)) -> (Word32, Word32) forall a b. a -> (a -> b) -> b & (Word32, Word32) -> Maybe (Word32, Word32) -> (Word32, Word32) forall a. a -> Maybe a -> a fromMaybe (Word32 0, Word32 0) requestAndHandle :: [(Maybe Text, Text)] -> (((Maybe Text, Text) -> (Word32, Word32)) -> f a) -> RequestingOid f a requestAndHandle :: forall (f :: * -> *) a. [(Maybe Text, Text)] -> (((Maybe Text, Text) -> (Word32, Word32)) -> f a) -> RequestingOid f a requestAndHandle = [(Maybe Text, Text)] -> (((Maybe Text, Text) -> (Word32, Word32)) -> f a) -> LookingUp (Maybe Text, Text) (Word32, Word32) f a forall k v (f :: * -> *) a. [k] -> ((k -> v) -> f a) -> LookingUp k v f a LookingUp.LookingUp lift :: f a -> RequestingOid f a lift :: forall (f :: * -> *) a. f a -> RequestingOid f a lift = f a -> LookingUp (Maybe Text, Text) (Word32, Word32) f a forall (f :: * -> *) a k v. f a -> LookingUp k v f a LookingUp.lift hoist :: (f a -> g b) -> RequestingOid f a -> RequestingOid g b hoist :: forall (f :: * -> *) a (g :: * -> *) b. (f a -> g b) -> RequestingOid f a -> RequestingOid g b hoist = (f a -> g b) -> LookingUp (Maybe Text, Text) (Word32, Word32) f a -> LookingUp (Maybe Text, Text) (Word32, Word32) g b forall (f :: * -> *) a (g :: * -> *) b k v. (f a -> g b) -> LookingUp k v f a -> LookingUp k v g b LookingUp.hoist lookup :: (Applicative f) => (Maybe Text, Text) -> RequestingOid f (Word32, Word32) lookup :: forall (f :: * -> *). Applicative f => (Maybe Text, Text) -> RequestingOid f (Word32, Word32) lookup = (Maybe Text, Text) -> LookingUp (Maybe Text, Text) (Word32, Word32) f (Word32, Word32) forall (f :: * -> *) k v. Applicative f => k -> LookingUp k v f v LookingUp.lookup lookingUp :: (Applicative f) => (Maybe Text, Text) -> ((Word32, Word32) -> f a) -> RequestingOid f a lookingUp :: forall (f :: * -> *) a. Applicative f => (Maybe Text, Text) -> ((Word32, Word32) -> f a) -> RequestingOid f a lookingUp = (Maybe Text, Text) -> ((Word32, Word32) -> f a) -> LookingUp (Maybe Text, Text) (Word32, Word32) f a forall k v (f :: * -> *) a. k -> (v -> f a) -> LookingUp k v f a LookingUp.lookingUp hoistLookingUp :: (Applicative f) => (Maybe Text, Text) -> ((Word32, Word32) -> f a -> g b) -> RequestingOid f a -> RequestingOid g b hoistLookingUp :: forall (f :: * -> *) a (g :: * -> *) b. Applicative f => (Maybe Text, Text) -> ((Word32, Word32) -> f a -> g b) -> RequestingOid f a -> RequestingOid g b hoistLookingUp = (Maybe Text, Text) -> ((Word32, Word32) -> f a -> g b) -> LookingUp (Maybe Text, Text) (Word32, Word32) f a -> LookingUp (Maybe Text, Text) (Word32, Word32) g b forall k v (f :: * -> *) a (g :: * -> *) b. k -> (v -> f a -> g b) -> LookingUp k v f a -> LookingUp k v g b LookingUp.hoistLookingUp