module Hasql.Private.Decoders.Value where

import Hasql.Private.Prelude
import qualified PostgreSQL.Binary.Decoding as A

newtype Value a
  = Value (Bool -> A.Value a)
  deriving (forall a b. a -> Value b -> Value a
forall a b. (a -> b) -> Value a -> Value b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Value b -> Value a
$c<$ :: forall a b. a -> Value b -> Value a
fmap :: forall a b. (a -> b) -> Value a -> Value b
$cfmap :: forall a b. (a -> b) -> Value a -> Value b
Functor)

{-# INLINE run #-}
run :: Value a -> Bool -> A.Value a
run :: forall a. Value a -> Bool -> Value a
run (Value Bool -> Value a
imp) Bool
integerDatetimes =
  Bool -> Value a
imp Bool
integerDatetimes

{-# INLINE decoder #-}
decoder :: (Bool -> A.Value a) -> Value a
decoder :: forall a. (Bool -> Value a) -> Value a
decoder =
  {-# SCC "decoder" #-}
  forall a. (Bool -> Value a) -> Value a
Value

{-# INLINE decoderFn #-}
decoderFn :: (Bool -> ByteString -> Either Text a) -> Value a
decoderFn :: forall a. (Bool -> ByteString -> Either Text a) -> Value a
decoderFn Bool -> ByteString -> Either Text a
fn =
  forall a. (Bool -> Value a) -> Value a
Value forall a b. (a -> b) -> a -> b
$ \Bool
integerDatetimes -> forall a. (ByteString -> Either Text a) -> Value a
A.fn forall a b. (a -> b) -> a -> b
$ Bool -> ByteString -> Either Text a
fn Bool
integerDatetimes