opaleye-0.7.3.0: An SQL-generating DSL targeting PostgreSQL
Safe HaskellNone
LanguageHaskell2010

Opaleye.Internal.MaybeFields

Synopsis

Documentation

data MaybeFields fields Source #

The Opaleye analogue of Maybe

Constructors

MaybeFields 

Fields

Instances

Instances details
Monad MaybeFields Source # 
Instance details

Defined in Opaleye.Internal.MaybeFields

Methods

(>>=) :: MaybeFields a -> (a -> MaybeFields b) -> MaybeFields b #

(>>) :: MaybeFields a -> MaybeFields b -> MaybeFields b #

return :: a -> MaybeFields a #

Functor MaybeFields Source # 
Instance details

Defined in Opaleye.Internal.MaybeFields

Methods

fmap :: (a -> b) -> MaybeFields a -> MaybeFields b #

(<$) :: a -> MaybeFields b -> MaybeFields a #

Applicative MaybeFields Source # 
Instance details

Defined in Opaleye.Internal.MaybeFields

Methods

pure :: a -> MaybeFields a #

(<*>) :: MaybeFields (a -> b) -> MaybeFields a -> MaybeFields b #

liftA2 :: (a -> b -> c) -> MaybeFields a -> MaybeFields b -> MaybeFields c #

(*>) :: MaybeFields a -> MaybeFields b -> MaybeFields b #

(<*) :: MaybeFields a -> MaybeFields b -> MaybeFields a #

Default Unpackspec a b => Default Unpackspec (MaybeFields a) (MaybeFields b) Source # 
Instance details

Defined in Opaleye.Internal.MaybeFields

Default (WithNulls Binaryspec) a b => Default Binaryspec (MaybeFields a) (MaybeFields b) Source # 
Instance details

Defined in Opaleye.Internal.MaybeFields

Default IfPP a b => Default IfPP (MaybeFields a) (MaybeFields b) Source # 
Instance details

Defined in Opaleye.Internal.MaybeFields

Methods

def :: IfPP (MaybeFields a) (MaybeFields b) #

Default EqPP a b => Default EqPP (MaybeFields a) (MaybeFields b) Source # 
Instance details

Defined in Opaleye.Internal.MaybeFields

Methods

def :: EqPP (MaybeFields a) (MaybeFields b) #

Default FromFields fields haskells => Default FromFields (MaybeFields fields) (Maybe haskells) Source # 
Instance details

Defined in Opaleye.Internal.MaybeFields

Methods

def :: FromFields (MaybeFields fields) (Maybe haskells) #

Default Valuesspec a b => Default Valuesspec (MaybeFields a) (MaybeFields b) Source # 
Instance details

Defined in Opaleye.Internal.MaybeFields

(Default ToFields a b, Default Nullspec a b) => Default ToFields (Maybe a) (MaybeFields b) Source # 
Instance details

Defined in Opaleye.Internal.MaybeFields

Methods

def :: ToFields (Maybe a) (MaybeFields b) #

Default (WithNulls Distinctspec) a b => Default Distinctspec (MaybeFields a) (MaybeFields b) Source # 
Instance details

Defined in Opaleye.Internal.Distinct

(Default (Inferrable FromFields) fields haskells, Maybe haskells ~ maybe_haskells) => Default (Inferrable FromFields) (MaybeFields fields) maybe_haskells Source # 
Instance details

Defined in Opaleye.Internal.MaybeFields

Methods

def :: Inferrable FromFields (MaybeFields fields) maybe_haskells #

nothingFields :: Default Nullspec a a => MaybeFields a Source #

The Opaleye analogue of Nothing.

nothingFieldsOfTypeOf :: a -> MaybeFields a Source #

The Opaleye analogue of const Nothing. Can be useful to avoid type inference problems, because it doesn't pick up a type class constraint.

justFields :: a -> MaybeFields a Source #

The Opaleye analogue of Just. Equivalent to pure.

maybeFields :: Default IfPP b b => b -> (a -> b) -> MaybeFields a -> b Source #

The Opaleye analogue of maybe

fromMaybeFields :: Default IfPP b b => b -> MaybeFields b -> b Source #

The Opaleye analogue of fromMaybe

catMaybeFields :: SelectArr i (MaybeFields a) -> SelectArr i a Source #

The Opaleye analogue of catMaybes

maybeFieldsExplicit :: IfPP b b' -> b -> (a -> b) -> MaybeFields a -> b' Source #

lateralLeftJoinOptional :: SelectArr i a -> SelectArr i b -> ((a, b) -> Field SqlBool) -> SelectArr i (a, MaybeFields b) Source #

An example to demonstrate how the functionality of (lateral) LEFT JOIN can be recovered using optional.

optionalRestrictOptional :: Select a -> SelectArr (a -> Field SqlBool) (MaybeFields a) Source #

An example to demonstrate how the functionality of optionalRestrict can be recovered using optional.

fromFieldsMaybeFields :: FromFields fields haskells -> FromFields (MaybeFields fields) (Maybe haskells) Source #

productProfunctorMaybeFields :: ProductProfunctor p => p (Field SqlBool) (Field SqlBool) -> p a b -> p (MaybeFields a) (MaybeFields b) Source #

This is not safe in general because it relies on p not doing anything observable with the as if mfPresent is false. In particular, it won't work for Distinctspec because it does indeed look at the mfFields to check distinctness.

unWithNulls :: ProductProfunctor p => p (Field SqlBool) (Field SqlBool) -> WithNulls p a b -> p (MaybeFields a) (MaybeFields b) Source #

This is only safe if d is OK with having nulls passed through it when they claim to be non-null.

newtype WithNulls p a b Source #

Constructors

WithNulls (p (MaybeFields a) b) 

Instances

Instances details
Profunctor p => Profunctor (WithNulls p) Source # 
Instance details

Defined in Opaleye.Internal.MaybeFields

Methods

dimap :: (a -> b) -> (c -> d) -> WithNulls p b c -> WithNulls p a d #

lmap :: (a -> b) -> WithNulls p b c -> WithNulls p a c #

rmap :: (b -> c) -> WithNulls p a b -> WithNulls p a c #

(#.) :: forall a b c q. Coercible c b => q b c -> WithNulls p a b -> WithNulls p a c #

(.#) :: forall a b c q. Coercible b a => WithNulls p b c -> q a b -> WithNulls p a c #

ProductProfunctor p => ProductProfunctor (WithNulls p) Source # 
Instance details

Defined in Opaleye.Internal.MaybeFields

Methods

purePP :: b -> WithNulls p a b #

(****) :: WithNulls p a (b -> c) -> WithNulls p a b -> WithNulls p a c #

empty :: WithNulls p () () #

(***!) :: WithNulls p a b -> WithNulls p a' b' -> WithNulls p (a, a') (b, b') #

SumProfunctor p => SumProfunctor (WithNulls p) Source # 
Instance details

Defined in Opaleye.Internal.MaybeFields

Methods

(+++!) :: WithNulls p a b -> WithNulls p a' b' -> WithNulls p (Either a a') (Either b b') #

(Profunctor p, IsSqlType a, Default p (Column a) (Column a)) => Default (WithNulls p) (Column a) (Column a) Source # 
Instance details

Defined in Opaleye.Internal.MaybeFields

Methods

def :: WithNulls p (Column a) (Column a) #

Profunctor p => Functor (WithNulls p a) Source # 
Instance details

Defined in Opaleye.Internal.MaybeFields

Methods

fmap :: (a0 -> b) -> WithNulls p a a0 -> WithNulls p a b #

(<$) :: a0 -> WithNulls p a b -> WithNulls p a a0 #

ProductProfunctor p => Applicative (WithNulls p a) Source # 
Instance details

Defined in Opaleye.Internal.MaybeFields

Methods

pure :: a0 -> WithNulls p a a0 #

(<*>) :: WithNulls p a (a0 -> b) -> WithNulls p a a0 -> WithNulls p a b #

liftA2 :: (a0 -> b -> c) -> WithNulls p a a0 -> WithNulls p a b -> WithNulls p a c #

(*>) :: WithNulls p a a0 -> WithNulls p a b -> WithNulls p a b #

(<*) :: WithNulls p a a0 -> WithNulls p a b -> WithNulls p a a0 #

mapMaybeFieldsWithNulls :: ProductProfunctor p => p (Field SqlBool) (Field SqlBool) -> WithNulls p a b -> WithNulls p (MaybeFields a) (MaybeFields b) Source #

This is only safe if d is OK with having nulls passed through it when they claim to be non-null.

withNullsField :: (IsSqlType a, Profunctor p) => p (Column a) (Column a) -> WithNulls p (Column a) (Column a) Source #

This is only safe if d is OK with having nulls passed through it when they claim to be non-null.

Orphan instances

(Default (Inferrable ToFields) a b, Default Nullspec a b, MaybeFields b ~ maybeFields_b) => Default (Inferrable ToFields) (Maybe a) maybeFields_b Source # 
Instance details

Methods

def :: Inferrable ToFields (Maybe a) maybeFields_b #