module Rel8.Query.Null
( catNull
)
where
import Prelude
import Rel8.Expr ( Expr )
import Rel8.Expr.Null ( isNonNull, unsafeUnnullify )
import Rel8.Query ( Query )
import Rel8.Query.Filter ( where_ )
catNull :: Expr (Maybe a) -> Query (Expr a)
catNull :: Expr (Maybe a) -> Query (Expr a)
catNull Expr (Maybe a)
a = do
Expr Bool -> Query ()
where_ (Expr Bool -> Query ()) -> Expr Bool -> Query ()
forall a b. (a -> b) -> a -> b
$ Expr (Maybe a) -> Expr Bool
forall a. Expr (Maybe a) -> Expr Bool
isNonNull Expr (Maybe a)
a
Expr a -> Query (Expr a)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Expr a -> Query (Expr a)) -> Expr a -> Query (Expr a)
forall a b. (a -> b) -> a -> b
$ Expr (Maybe a) -> Expr a
forall a. Expr (Maybe a) -> Expr a
unsafeUnnullify Expr (Maybe a)
a