Safe Haskell | None |
---|---|

Language | Haskell2010 |

## Synopsis

- data MaybeFields fields = MaybeFields {}
- nothingFields :: Default Nullspec a a => MaybeFields a
- nothingFieldsOfTypeOf :: a -> MaybeFields a
- justFields :: a -> MaybeFields a
- maybeFields :: Default IfPP b b => b -> (a -> b) -> MaybeFields a -> b
- fromMaybeFields :: Default IfPP b b => b -> MaybeFields b -> b
- maybeFieldsToSelect :: SelectArr (MaybeFields a) a
- catMaybeFields :: SelectArr i (MaybeFields a) -> SelectArr i a
- maybeFieldsExplicit :: IfPP b b' -> b -> (a -> b) -> MaybeFields a -> b'
- fromMaybeFieldsExplicit :: IfPP b b -> b -> MaybeFields b -> b
- nothingFieldsExplicit :: Nullspec a b -> MaybeFields b
- traverseMaybeFields :: SelectArr a b -> SelectArr (MaybeFields a) (MaybeFields b)
- optional :: SelectArr i a -> SelectArr i (MaybeFields a)
- lateralLeftJoinOptional :: SelectArr i a -> SelectArr i b -> ((a, b) -> Field SqlBool) -> SelectArr i (a, MaybeFields b)
- optionalRestrictOptional :: Select a -> SelectArr (a -> Field SqlBool) (MaybeFields a)
- fromFieldsMaybeFields :: FromFields fields haskells -> FromFields (MaybeFields fields) (Maybe haskells)
- productProfunctorMaybeFields :: ProductProfunctor p => p (Field SqlBool) (Field SqlBool) -> p a b -> p (MaybeFields a) (MaybeFields b)
- nullspecMaybeFields :: Nullspec a b -> Nullspec (MaybeFields a) (MaybeFields b)
- unpackspecMaybeFields :: Unpackspec a b -> Unpackspec (MaybeFields a) (MaybeFields b)
- valuesspecMaybeFields :: Valuesspec a b -> Valuesspec (MaybeFields a) (MaybeFields b)
- toFieldsMaybeFields :: Nullspec a b -> ToFields a b -> ToFields (Maybe a) (MaybeFields b)
- ifPPMaybeFields :: IfPP a b -> IfPP (MaybeFields a) (MaybeFields b)
- eqPPMaybeFields :: EqPP a b -> EqPP (MaybeFields a) (MaybeFields b)
- unWithNulls :: ProductProfunctor p => p (Field SqlBool) (Field SqlBool) -> WithNulls p a b -> p (MaybeFields a) (MaybeFields b)
- newtype WithNulls p a b = WithNulls (p (MaybeFields a) b)
- mapMaybeFieldsWithNulls :: ProductProfunctor p => p (Field SqlBool) (Field SqlBool) -> WithNulls p a b -> WithNulls p (MaybeFields a) (MaybeFields b)
- withNullsField :: (IsSqlType a, Profunctor p) => p (Column a) (Column a) -> WithNulls p (Column a) (Column a)
- binaryspecMaybeFields :: WithNulls Binaryspec a b -> Binaryspec (MaybeFields a) (MaybeFields b)

# Documentation

data MaybeFields fields Source #

The Opaleye analogue of `Maybe`

## Instances

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

The Opaleye analogue of `Nothing`

.

nothingFieldsOfTypeOf :: a -> MaybeFields a Source #

justFields :: a -> MaybeFields a Source #

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`

maybeFieldsToSelect :: SelectArr (MaybeFields a) a Source #

The Opaleye analogue of `maybeToList`

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 #

fromMaybeFieldsExplicit :: IfPP b b -> b -> MaybeFields b -> b Source #

nothingFieldsExplicit :: Nullspec a b -> MaybeFields b Source #

traverseMaybeFields :: SelectArr a b -> SelectArr (MaybeFields a) (MaybeFields 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 `a`

s if `mfPresent`

is false. In
particular, it won't work for
`Distinctspec`

because it does indeed
look at the `mfFields`

to check distinctness.

nullspecMaybeFields :: Nullspec a b -> Nullspec (MaybeFields a) (MaybeFields b) Source #

unpackspecMaybeFields :: Unpackspec a b -> Unpackspec (MaybeFields a) (MaybeFields b) Source #

valuesspecMaybeFields :: Valuesspec a b -> Valuesspec (MaybeFields a) (MaybeFields b) Source #

toFieldsMaybeFields :: Nullspec a b -> ToFields a b -> ToFields (Maybe a) (MaybeFields b) Source #

ifPPMaybeFields :: IfPP a b -> IfPP (MaybeFields a) (MaybeFields b) Source #

eqPPMaybeFields :: EqPP a b -> EqPP (MaybeFields a) (MaybeFields b) Source #

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 #

WithNulls (p (MaybeFields a) b) |

## Instances

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.

binaryspecMaybeFields :: WithNulls Binaryspec a b -> Binaryspec (MaybeFields a) (MaybeFields b) Source #

# Orphan instances

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

def :: Inferrable ToFields (Maybe a) maybeFields_b # |