rel8-internal
Safe HaskellNone
LanguageHaskell2010

Rel8.Internal.Expr.Null

Synopsis

Documentation

null :: DBType a => Expr (Maybe a) Source #

Corresponds to SQL null.

nullableExpr :: Expr b -> (Expr a -> Expr b) -> Expr (Maybe a) -> Expr b Source #

Like maybe, but to eliminate null.

isNull :: Expr (Maybe a) -> Expr Bool Source #

Like isNothing, but for null.

isNonNull :: Expr (Maybe a) -> Expr Bool Source #

Like isJust, but for null.

nullify :: NotNull a => Expr a -> Expr (Maybe a) Source #

Lift an expression that can't be null to a type that might be null. This is an identity operation in terms of any generated query, and just modifies the query's type.

unsafeUnnullify :: Expr (Maybe a) -> Expr a Source #

Assume that a nullable column's value is non-null. If the column is actually null, this will lead to runtime errors when you try to decode the value into Haskell, so you should prefer to use nullable unless you know what you're doing.

mapNull :: DBType b => (Expr a -> Expr b) -> Expr (Maybe a) -> Expr (Maybe b) Source #

Lift an operation on non-null values to an operation on possibly null values. When given null, mapNull f returns null.

This is like fmap for Maybe.

liftOpNull :: DBType c => (Expr a -> Expr b -> Expr c) -> Expr (Maybe a) -> Expr (Maybe b) -> Expr (Maybe c) Source #

Lift a binary operation on non-null expressions to an equivalent binary operator on possibly null expressions. If either of the final arguments are null, liftOpNull returns null.

This is like liftA2 for Maybe.

unsafeMapNull :: NotNull b => (Expr a -> Expr b) -> Expr (Maybe a) -> Expr (Maybe b) Source #

unsafeLiftOpNull :: NotNull c => (Expr a -> Expr b -> Expr c) -> Expr (Maybe a) -> Expr (Maybe b) -> Expr (Maybe c) Source #