{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE CPP #-}
module ProjectM36.Tupleable
( toInsertExpr
, toDefineExpr
, tupleAssocsEqualityPredicate
, partitionByAttributes
, toUpdateExpr
, toDeleteExpr
, validateAttributes
, Tupleable(..)
, genericToTuple
, genericFromTuple
, genericToAttributes
, TupleableG(..)
, defaultTupleableOptions
, TupleableOptions()
, fieldModifier
) where
import Data.Foldable
import Data.List (partition)
import qualified Data.Map as Map
#if __GLASGOW_HASKELL__ < 804
import Data.Monoid
#endif
import Data.Proxy
import qualified Data.Text as T
import qualified Data.Vector as V
import GHC.Generics
import ProjectM36.Atomable
import ProjectM36.Attribute as A hiding (null, toList)
import ProjectM36.Base
import ProjectM36.DataTypes.Primitive
import ProjectM36.Error
import ProjectM36.Tuple
import ProjectM36.TupleSet
import qualified Data.Set as S
toInsertExpr :: forall a t. (Tupleable a, Traversable t) => t a -> RelVarName -> Either RelationalError DatabaseContextExpr
toInsertExpr :: forall a (t :: * -> *).
(Tupleable a, Traversable t) =>
t a -> RelVarName -> Either RelationalError DatabaseContextExpr
toInsertExpr t a
vals RelVarName
rvName = do
let attrs :: Attributes
attrs = forall a. Tupleable a => Proxy a -> Attributes
toAttributes (forall {k} (t :: k). Proxy t
Proxy :: Proxy a)
RelationTupleSet
tuples <- Attributes
-> [RelationTuple] -> Either RelationalError RelationTupleSet
mkTupleSet Attributes
attrs forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Tupleable a => a -> RelationTuple
toTuple t a
vals)
let rel :: RelationalExprBase a
rel = forall a. Attributes -> RelationTupleSet -> RelationalExprBase a
MakeStaticRelation Attributes
attrs RelationTupleSet
tuples
forall (f :: * -> *) a. Applicative f => a -> f a
pure (forall a.
RelVarName -> RelationalExprBase a -> DatabaseContextExprBase a
Insert RelVarName
rvName forall {a}. RelationalExprBase a
rel)
toDefineExpr :: forall a proxy. Tupleable a => proxy a -> RelVarName -> DatabaseContextExpr
toDefineExpr :: forall a (proxy :: * -> *).
Tupleable a =>
proxy a -> RelVarName -> DatabaseContextExpr
toDefineExpr proxy a
_ RelVarName
rvName = forall a.
RelVarName -> [AttributeExprBase a] -> DatabaseContextExprBase a
Define RelVarName
rvName (forall a b. (a -> b) -> [a] -> [b]
map forall a. Attribute -> AttributeExprBase a
NakedAttributeExpr (forall a. Vector a -> [a]
V.toList (Attributes -> Vector Attribute
attributesVec Attributes
attrs)))
where
attrs :: Attributes
attrs = forall a. Tupleable a => Proxy a -> Attributes
toAttributes (forall {k} (t :: k). Proxy t
Proxy :: Proxy a)
tupleAssocsEqualityPredicate :: [(AttributeName, Atom)] -> RestrictionPredicateExpr
tupleAssocsEqualityPredicate :: [(RelVarName, Atom)] -> RestrictionPredicateExpr
tupleAssocsEqualityPredicate [] = forall a. RestrictionPredicateExprBase a
TruePredicate
tupleAssocsEqualityPredicate [(RelVarName, Atom)]
pairs =
forall (t :: * -> *) a. Foldable t => (a -> a -> a) -> t a -> a
foldr1 forall a.
RestrictionPredicateExprBase a
-> RestrictionPredicateExprBase a -> RestrictionPredicateExprBase a
AndPredicate forall a b. (a -> b) -> a -> b
$
forall a b. (a -> b) -> [a] -> [b]
map
(\(RelVarName
name, Atom
atom) -> forall a.
RelVarName -> AtomExprBase a -> RestrictionPredicateExprBase a
AttributeEqualityPredicate RelVarName
name (forall a. Atom -> AtomExprBase a
NakedAtomExpr Atom
atom))
[(RelVarName, Atom)]
pairs
partitionByAttributes ::
Tupleable a
=> [AttributeName]
-> a
-> ([(AttributeName, Atom)], [(AttributeName, Atom)])
partitionByAttributes :: forall a.
Tupleable a =>
[RelVarName] -> a -> ([(RelVarName, Atom)], [(RelVarName, Atom)])
partitionByAttributes [RelVarName]
attrs =
forall a. (a -> Bool) -> [a] -> ([a], [a])
partition ((forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [RelVarName]
attrs) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> a
fst) forall b c a. (b -> c) -> (a -> b) -> a -> c
. RelationTuple -> [(RelVarName, Atom)]
tupleAssocs forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Tupleable a => a -> RelationTuple
toTuple
toUpdateExpr ::
forall a. Tupleable a => RelVarName -> [AttributeName] -> a -> Either RelationalError DatabaseContextExpr
toUpdateExpr :: forall a.
Tupleable a =>
RelVarName
-> [RelVarName] -> a -> Either RelationalError DatabaseContextExpr
toUpdateExpr RelVarName
rvName [RelVarName]
keyAttrs a
a = forall a.
Set RelVarName -> Set RelVarName -> a -> Either RelationalError a
validateAttributes (forall a. Ord a => [a] -> Set a
S.fromList [RelVarName]
keyAttrs) Set RelVarName
expectedAttrSet (forall a.
RelVarName
-> AttributeNameAtomExprMap
-> RestrictionPredicateExprBase a
-> DatabaseContextExprBase a
Update RelVarName
rvName forall {a}. Map RelVarName (AtomExprBase a)
updateMap RestrictionPredicateExpr
keyRestriction)
where
([(RelVarName, Atom)]
keyPairs, [(RelVarName, Atom)]
updatePairs) = forall a.
Tupleable a =>
[RelVarName] -> a -> ([(RelVarName, Atom)], [(RelVarName, Atom)])
partitionByAttributes [RelVarName]
keyAttrs a
a
updateMap :: Map RelVarName (AtomExprBase a)
updateMap = forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Atom -> AtomExprBase a
NakedAtomExpr forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [(RelVarName, Atom)]
updatePairs
keyRestriction :: RestrictionPredicateExpr
keyRestriction = [(RelVarName, Atom)] -> RestrictionPredicateExpr
tupleAssocsEqualityPredicate [(RelVarName, Atom)]
keyPairs
expectedAttrSet :: Set RelVarName
expectedAttrSet = Attributes -> Set RelVarName
attributeNameSet (forall a. Tupleable a => Proxy a -> Attributes
toAttributes (forall {k} (t :: k). Proxy t
Proxy :: Proxy a))
toDeleteExpr ::
forall a. Tupleable a => RelVarName -> [AttributeName] -> a -> Either RelationalError DatabaseContextExpr
toDeleteExpr :: forall a.
Tupleable a =>
RelVarName
-> [RelVarName] -> a -> Either RelationalError DatabaseContextExpr
toDeleteExpr RelVarName
rvName [RelVarName]
keyAttrs a
val = forall a.
Set RelVarName -> Set RelVarName -> a -> Either RelationalError a
validateAttributes (forall a. Ord a => [a] -> Set a
S.fromList [RelVarName]
keyAttrs) Set RelVarName
expectedAttrSet (forall a.
RelVarName
-> RestrictionPredicateExprBase a -> DatabaseContextExprBase a
Delete RelVarName
rvName RestrictionPredicateExpr
keyRestriction)
where
keyPairs :: [(RelVarName, Atom)]
keyPairs = forall a b. (a, b) -> a
fst forall a b. (a -> b) -> a -> b
$ forall a.
Tupleable a =>
[RelVarName] -> a -> ([(RelVarName, Atom)], [(RelVarName, Atom)])
partitionByAttributes [RelVarName]
keyAttrs a
val
keyRestriction :: RestrictionPredicateExpr
keyRestriction = [(RelVarName, Atom)] -> RestrictionPredicateExpr
tupleAssocsEqualityPredicate [(RelVarName, Atom)]
keyPairs
expectedAttrSet :: Set RelVarName
expectedAttrSet = Attributes -> Set RelVarName
attributeNameSet (forall a. Tupleable a => Proxy a -> Attributes
toAttributes (forall {k} (t :: k). Proxy t
Proxy :: Proxy a))
validateAttributes :: S.Set AttributeName -> S.Set AttributeName -> a -> Either RelationalError a
validateAttributes :: forall a.
Set RelVarName -> Set RelVarName -> a -> Either RelationalError a
validateAttributes Set RelVarName
actualAttrs Set RelVarName
expectedAttrs a
val
| forall a. Set a -> Bool
S.null Set RelVarName
actualAttrs = forall a b. a -> Either a b
Left RelationalError
EmptyAttributesError
| Bool -> Bool
not (forall a. Set a -> Bool
S.null Set RelVarName
nonMatchingAttrs) = forall a b. a -> Either a b
Left (Set RelVarName -> RelationalError
NoSuchAttributeNamesError Set RelVarName
nonMatchingAttrs)
| Bool
otherwise = forall a b. b -> Either a b
Right a
val
where
nonMatchingAttrs :: Set RelVarName
nonMatchingAttrs = Set RelVarName -> Set RelVarName -> Set RelVarName
attributeNamesNotContained Set RelVarName
actualAttrs Set RelVarName
expectedAttrs
class Tupleable a where
toTuple :: a -> RelationTuple
fromTuple :: RelationTuple -> Either RelationalError a
toAttributes :: Proxy a -> Attributes
default toTuple :: (Generic a, TupleableG (Rep a)) => a -> RelationTuple
toTuple = forall a.
(Generic a, TupleableG (Rep a)) =>
TupleableOptions -> a -> RelationTuple
genericToTuple TupleableOptions
defaultTupleableOptions
default fromTuple :: (Generic a, TupleableG (Rep a)) => RelationTuple -> Either RelationalError a
fromTuple = forall a.
(Generic a, TupleableG (Rep a)) =>
TupleableOptions -> RelationTuple -> Either RelationalError a
genericFromTuple TupleableOptions
defaultTupleableOptions
default toAttributes :: (Generic a, TupleableG (Rep a)) => Proxy a -> Attributes
toAttributes = forall a.
(Generic a, TupleableG (Rep a)) =>
TupleableOptions -> Proxy a -> Attributes
genericToAttributes TupleableOptions
defaultTupleableOptions
newtype TupleableOptions = TupleableOptions {
TupleableOptions -> RelVarName -> RelVarName
fieldModifier :: T.Text -> T.Text
}
defaultTupleableOptions :: TupleableOptions
defaultTupleableOptions :: TupleableOptions
defaultTupleableOptions = TupleableOptions {
fieldModifier :: RelVarName -> RelVarName
fieldModifier = forall a. a -> a
id
}
genericToTuple :: (Generic a, TupleableG (Rep a)) => TupleableOptions -> a -> RelationTuple
genericToTuple :: forall a.
(Generic a, TupleableG (Rep a)) =>
TupleableOptions -> a -> RelationTuple
genericToTuple TupleableOptions
opts a
v = forall (g :: * -> *) a.
TupleableG g =>
TupleableOptions -> g a -> RelationTuple
toTupleG TupleableOptions
opts (forall a x. Generic a => a -> Rep a x
from a
v)
genericFromTuple :: (Generic a, TupleableG (Rep a)) => TupleableOptions -> RelationTuple -> Either RelationalError a
genericFromTuple :: forall a.
(Generic a, TupleableG (Rep a)) =>
TupleableOptions -> RelationTuple -> Either RelationalError a
genericFromTuple TupleableOptions
opts RelationTuple
tup = forall a x. Generic a => Rep a x -> a
to forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (g :: * -> *) a.
TupleableG g =>
TupleableOptions -> RelationTuple -> Either RelationalError (g a)
fromTupleG TupleableOptions
opts RelationTuple
tup
genericToAttributes :: forall a. (Generic a, TupleableG (Rep a)) => TupleableOptions -> Proxy a -> Attributes
genericToAttributes :: forall a.
(Generic a, TupleableG (Rep a)) =>
TupleableOptions -> Proxy a -> Attributes
genericToAttributes TupleableOptions
opts Proxy a
_ = forall (g :: * -> *) a.
TupleableG g =>
TupleableOptions -> g a -> Attributes
toAttributesG TupleableOptions
opts (forall a x. Generic a => a -> Rep a x
from (forall a. HasCallStack => a
undefined :: a))
class TupleableG g where
toTupleG :: TupleableOptions -> g a -> RelationTuple
toAttributesG :: TupleableOptions -> g a -> Attributes
fromTupleG :: TupleableOptions -> RelationTuple -> Either RelationalError (g a)
isRecordTypeG :: g a -> Bool
instance (Datatype c, TupleableG a) => TupleableG (M1 D c a) where
toTupleG :: forall a. TupleableOptions -> M1 D c a a -> RelationTuple
toTupleG TupleableOptions
opts (M1 a a
v) = forall (g :: * -> *) a.
TupleableG g =>
TupleableOptions -> g a -> RelationTuple
toTupleG TupleableOptions
opts a a
v
toAttributesG :: forall a. TupleableOptions -> M1 D c a a -> Attributes
toAttributesG TupleableOptions
opts (M1 a a
v) = forall (g :: * -> *) a.
TupleableG g =>
TupleableOptions -> g a -> Attributes
toAttributesG TupleableOptions
opts a a
v
fromTupleG :: forall a.
TupleableOptions
-> RelationTuple -> Either RelationalError (M1 D c a a)
fromTupleG TupleableOptions
opts RelationTuple
v = forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
M1 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (g :: * -> *) a.
TupleableG g =>
TupleableOptions -> RelationTuple -> Either RelationalError (g a)
fromTupleG TupleableOptions
opts RelationTuple
v
isRecordTypeG :: forall a. M1 D c a a -> Bool
isRecordTypeG (M1 a a
v) = forall (g :: * -> *) a. TupleableG g => g a -> Bool
isRecordTypeG a a
v
instance (Constructor c, TupleableG a, AtomableG a) => TupleableG (M1 C c a) where
toTupleG :: forall a. TupleableOptions -> M1 C c a a -> RelationTuple
toTupleG TupleableOptions
opts (M1 a a
v) = Attributes -> Vector Atom -> RelationTuple
RelationTuple Attributes
attrs Vector Atom
atoms
where
attrsToCheck :: Attributes
attrsToCheck = forall (g :: * -> *) a.
TupleableG g =>
TupleableOptions -> g a -> Attributes
toAttributesG TupleableOptions
opts a a
v
counter :: Vector Int
counter = forall a. Int -> (Int -> a) -> Vector a
V.generate (Attributes -> Int
arity Attributes
attrsToCheck) forall a. a -> a
id
attrs :: Attributes
attrs = [Attribute] -> Attributes
attributesFromList (forall a. Vector a -> [a]
V.toList Vector Attribute
attrsV)
attrsV :: Vector Attribute
attrsV = forall a b c. (a -> b -> c) -> Vector a -> Vector b -> Vector c
V.zipWith (\Int
num attr :: Attribute
attr@(Attribute RelVarName
name AtomType
typ) -> if RelVarName -> Bool
T.null RelVarName
name then
RelVarName -> AtomType -> Attribute
Attribute (RelVarName
"attr" forall a. Semigroup a => a -> a -> a
<> String -> RelVarName
T.pack (forall a. Show a => a -> String
show (Int
num forall a. Num a => a -> a -> a
+ Int
1))) AtomType
typ
else
Attribute
attr) Vector Int
counter (Attributes -> Vector Attribute
attributesVec Attributes
attrsToCheck)
atoms :: Vector Atom
atoms = forall a. [a] -> Vector a
V.fromList (forall {k} (g :: k -> *) (a :: k). AtomableG g => g a -> [Atom]
toAtomsG a a
v)
toAttributesG :: forall a. TupleableOptions -> M1 C c a a -> Attributes
toAttributesG TupleableOptions
opts (M1 a a
v) = forall (g :: * -> *) a.
TupleableG g =>
TupleableOptions -> g a -> Attributes
toAttributesG TupleableOptions
opts a a
v
fromTupleG :: forall a.
TupleableOptions
-> RelationTuple -> Either RelationalError (M1 C c a a)
fromTupleG TupleableOptions
opts RelationTuple
tup = forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
M1 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (g :: * -> *) a.
TupleableG g =>
TupleableOptions -> RelationTuple -> Either RelationalError (g a)
fromTupleG TupleableOptions
opts RelationTuple
tup
isRecordTypeG :: forall a. M1 C c a a -> Bool
isRecordTypeG (M1 a a
v) = forall (g :: * -> *) a. TupleableG g => g a -> Bool
isRecordTypeG a a
v
instance (TupleableG a, TupleableG b) => TupleableG (a :*: b) where
toTupleG :: forall a. TupleableOptions -> (:*:) a b a -> RelationTuple
toTupleG = forall a. HasCallStack => String -> a
error String
"toTupleG"
toAttributesG :: forall a. TupleableOptions -> (:*:) a b a -> Attributes
toAttributesG TupleableOptions
opts ~(a a
x :*: b a
y) = forall (g :: * -> *) a.
TupleableG g =>
TupleableOptions -> g a -> Attributes
toAttributesG TupleableOptions
opts a a
x forall a. Semigroup a => a -> a -> a
<> forall (g :: * -> *) a.
TupleableG g =>
TupleableOptions -> g a -> Attributes
toAttributesG TupleableOptions
opts b a
y
fromTupleG :: forall a.
TupleableOptions
-> RelationTuple -> Either RelationalError ((:*:) a b a)
fromTupleG TupleableOptions
opts RelationTuple
tup = forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
(:*:) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (g :: * -> *) a.
TupleableG g =>
TupleableOptions -> RelationTuple -> Either RelationalError (g a)
fromTupleG TupleableOptions
opts RelationTuple
tup forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (g :: * -> *) a.
TupleableG g =>
TupleableOptions -> RelationTuple -> Either RelationalError (g a)
fromTupleG TupleableOptions
opts RelationTuple
processedTuple
where
processedTuple :: RelationTuple
processedTuple = if forall (g :: * -> *) a. TupleableG g => g a -> Bool
isRecordTypeG (forall a. HasCallStack => a
undefined :: a x) then
RelationTuple
tup
else
Int -> RelationTuple -> RelationTuple
trimTuple Int
1 RelationTuple
tup
isRecordTypeG :: forall a. (:*:) a b a -> Bool
isRecordTypeG ~(a a
x :*: b a
y) = forall (g :: * -> *) a. TupleableG g => g a -> Bool
isRecordTypeG a a
x Bool -> Bool -> Bool
|| forall (g :: * -> *) a. TupleableG g => g a -> Bool
isRecordTypeG b a
y
instance (Selector c, AtomableG a) => TupleableG (M1 S c a) where
toTupleG :: forall a. TupleableOptions -> M1 S c a a -> RelationTuple
toTupleG = forall a. HasCallStack => String -> a
error String
"toTupleG"
toAttributesG :: forall a. TupleableOptions -> M1 S c a a -> Attributes
toAttributesG TupleableOptions
opts m :: M1 S c a a
m@(M1 a a
v) = Attribute -> Attributes
A.singleton (RelVarName -> AtomType -> Attribute
Attribute RelVarName
modifiedName AtomType
aType)
where
name :: RelVarName
name = String -> RelVarName
T.pack (forall {k} (s :: k) k1 (t :: k -> (k1 -> *) -> k1 -> *)
(f :: k1 -> *) (a :: k1).
Selector s =>
t s f a -> String
selName M1 S c a a
m)
modifiedName :: RelVarName
modifiedName = if RelVarName -> Bool
T.null RelVarName
name then
RelVarName
name
else
TupleableOptions -> RelVarName -> RelVarName
fieldModifier TupleableOptions
opts RelVarName
name
aType :: AtomType
aType = forall {k} (g :: k -> *) (a :: k). AtomableG g => g a -> AtomType
toAtomTypeG a a
v
fromTupleG :: forall a.
TupleableOptions
-> RelationTuple -> Either RelationalError (M1 S c a a)
fromTupleG TupleableOptions
opts RelationTuple
tup = if forall (t :: * -> *) a. Foldable t => t a -> Bool
null String
name then
forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
M1 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall {g :: * -> *} {a}.
AtomableG g =>
Atom -> Either RelationalError (g a)
atomv (forall a. Vector a -> a
V.head (RelationTuple -> Vector Atom
tupleAtoms RelationTuple
tup))
else do
Atom
atom <- RelVarName -> RelationTuple -> Either RelationalError Atom
atomForAttributeName (TupleableOptions -> RelVarName -> RelVarName
fieldModifier TupleableOptions
opts (String -> RelVarName
T.pack String
name)) RelationTuple
tup
a a
val <- forall {g :: * -> *} {a}.
AtomableG g =>
Atom -> Either RelationalError (g a)
atomv Atom
atom
forall (f :: * -> *) a. Applicative f => a -> f a
pure (forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
M1 a a
val)
where
expectedAtomType :: AtomType
expectedAtomType = Attribute -> AtomType
atomType (forall a. Vector a -> a
V.head (Attributes -> Vector Attribute
attributesVec (forall (g :: * -> *) a.
TupleableG g =>
TupleableOptions -> g a -> Attributes
toAttributesG TupleableOptions
opts (forall a. HasCallStack => a
undefined :: M1 S c a x))))
atomv :: Atom -> Either RelationalError (g a)
atomv Atom
atom = forall b a. b -> (a -> b) -> Maybe a -> b
maybe (forall a b. a -> Either a b
Left (AtomType -> AtomType -> RelationalError
AtomTypeMismatchError
AtomType
expectedAtomType
(Atom -> AtomType
atomTypeForAtom Atom
atom)
)) forall a b. b -> Either a b
Right (forall {k} (g :: k -> *) (a :: k).
AtomableG g =>
Atom -> [Atom] -> Maybe (g a)
fromAtomG Atom
atom [Atom
atom])
name :: String
name = forall {k} (s :: k) k1 (t :: k -> (k1 -> *) -> k1 -> *)
(f :: k1 -> *) (a :: k1).
Selector s =>
t s f a -> String
selName (forall a. HasCallStack => a
undefined :: M1 S c a x)
isRecordTypeG :: forall a. M1 S c a a -> Bool
isRecordTypeG M1 S c a a
_ = Bool -> Bool
not (forall (t :: * -> *) a. Foldable t => t a -> Bool
null (forall {k} (s :: k) k1 (t :: k -> (k1 -> *) -> k1 -> *)
(f :: k1 -> *) (a :: k1).
Selector s =>
t s f a -> String
selName (forall a. HasCallStack => a
undefined :: M1 S c a x)))
instance TupleableG U1 where
toTupleG :: forall a. TupleableOptions -> U1 a -> RelationTuple
toTupleG TupleableOptions
_ U1 a
_ = RelationTuple
emptyTuple
toAttributesG :: forall a. TupleableOptions -> U1 a -> Attributes
toAttributesG TupleableOptions
_ U1 a
_ = Attributes
emptyAttributes
fromTupleG :: forall a.
TupleableOptions -> RelationTuple -> Either RelationalError (U1 a)
fromTupleG TupleableOptions
_ RelationTuple
_ = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall k (p :: k). U1 p
U1
isRecordTypeG :: forall a. U1 a -> Bool
isRecordTypeG U1 a
_ = Bool
False