module Hasql.Connection.Config where import Hasql.Prelude data Config = Config { Config -> ByteString connectionString :: ByteString, Config -> Bool usePreparedStatements :: Bool } class Updates a where update :: a -> Config -> Config nil :: Config nil :: Config nil = Config { connectionString :: ByteString connectionString = ByteString "", usePreparedStatements :: Bool usePreparedStatements = Bool True } fromUpdates :: (Updates a) => [a] -> Config fromUpdates :: forall a. Updates a => [a] -> Config fromUpdates = (Config -> a -> Config) -> Config -> [a] -> Config forall b a. (b -> a -> b) -> b -> [a] -> b forall (t :: * -> *) b a. Foldable t => (b -> a -> b) -> b -> t a -> b foldl' ((a -> Config -> Config) -> Config -> a -> Config forall a b c. (a -> b -> c) -> b -> a -> c flip a -> Config -> Config forall a. Updates a => a -> Config -> Config update) Config nil setConnectionString :: ByteString -> Config -> Config setConnectionString :: ByteString -> Config -> Config setConnectionString ByteString connectionString Config config = Config config {connectionString} setUsePreparedStatements :: Bool -> Config -> Config setUsePreparedStatements :: Bool -> Config -> Config setUsePreparedStatements Bool usePreparedStatements Config config = Config config {usePreparedStatements}