@@ -23,7 +23,7 @@ import qualified Opaleye.Internal.HaskellDB.PrimQuery as Opaleye
2323import {-# SOURCE #-} Rel8.Expr ( Expr( Expr ) )
2424import Rel8.Expr.Bool ( (||.), boolExpr )
2525import Rel8.Expr.Opaleye ( scastExpr, mapPrimExpr )
26−import Rel8.Schema.Nullability ( IsMaybe )
26+import Rel8.Schema.Nullability ( NotNull )
2727import Rel8.Type ( DBType, typeInformation )
2828import Rel8.Type.Information ( TypeInformation )
2929
@@ -31,7 +31,7 @@ import Rel8.Type.Information ( TypeInformation )
3131-- | Lift an expression that can't be @null@ to a type that might be @null@.
3232-- This is an identity operation in terms of any generated query, and just
3333-- modifies the query's type.
34−nullify :: IsMaybe a ~ 'False => Expr a -> Expr (Maybe a)
34+nullify :: NotNull a => Expr a -> Expr (Maybe a)
3535nullify (Expr a) = Expr a
3636
3737
@@ -50,8 +50,7 @@ nullable :: Expr b -> (Expr a -> Expr b) -> Expr (Maybe a) -> Expr b
5050nullable b f ma = boolExpr (f (unsafeUnnullify ma)) b (isNull ma)
5151
5252
53−nullableOf :: (IsMaybe a ~ 'False, DBType a)
54− => Maybe (Expr a) -> Expr (Maybe a)
53+nullableOf :: DBType a => Maybe (Expr a) -> Expr (Maybe a)
5554nullableOf = maybe null nullify
5655
5756
@@ -75,7 +74,7 @@ isNonNull = mapPrimExpr (Opaleye.UnExpr Opaleye.OpIsNotNull)
7574-- values. When given @null@, @mapNullable f@ returns @null@.
7675--
7776-- This is like 'fmap' for 'Maybe'.
78−mapNullable :: (IsMaybe b ~ 'False, DBType b)
77+mapNullable :: DBType b
7978 => (Expr a -> Expr b) -> Expr (Maybe a) -> Expr (Maybe b)
8079mapNullable f ma = boolExpr (unsafeMapNullable f ma) null (isNull ma)
8180
@@ -85,7 +84,7 @@ mapNullable f ma = boolExpr (unsafeMapNullable f ma) null (isNull ma)
8584-- are @null@, @liftOpNullable@ returns @null@.
8685--
8786-- This is like 'liftA2' for 'Maybe'.
88−liftOpNullable :: (IsMaybe c ~ 'False, DBType c)
87+liftOpNullable :: DBType c
8988 => (Expr a -> Expr b -> Expr c)
9089 -> Expr (Maybe a) -> Expr (Maybe b) -> Expr (Maybe c)
9190liftOpNullable f ma mb =
@@ -98,16 +97,16 @@ snull info = scastExpr info $ Expr $ Opaleye.ConstExpr Opaleye.NullLit
9897
9998
10099-- | Corresponds to SQL @null@.
101−null :: (IsMaybe a ~ 'False, DBType a) => Expr (Maybe a)
100+null :: DBType a => Expr (Maybe a)
102101null = snull typeInformation
103102
104103
105−unsafeMapNullable :: IsMaybe b ~ 'False
104+unsafeMapNullable :: NotNull b
106105 => (Expr a -> Expr b) -> Expr (Maybe a) -> Expr (Maybe b)
107106unsafeMapNullable f ma = nullify (f (unsafeUnnullify ma))
108107
109108
110−unsafeLiftOpNullable :: IsMaybe c ~ 'False
109+unsafeLiftOpNullable :: NotNull c
111110 => (Expr a -> Expr b -> Expr c)
112111 -> Expr (Maybe a) -> Expr (Maybe b) -> Expr (Maybe c)
113112unsafeLiftOpNullable f ma mb =