on dev help sign in
remove RelationToNullityTypes

and some renaming

commitc1968c4d98e009a8ae3ac5746706c9e04e0d29d6 authorEitan Chatav <eitan.chatav@gmail.com> dateWed 29 Aug 2018, 12:00 (8 years ago) parentb5a006e
2 files changed+16−22
squeal-postgresql/src/Squeal/PostgreSQL/Query.hs+3−3 squeal-postgresql/src/Squeal/PostgreSQL/Schema.hs+13−19
squeal-postgresql/src/Squeal/PostgreSQL/Query.hs+3−3
@@ -956,7 +956,7 @@ leftOuterJoin
956956 -- ^ @on@ condition
957957 -> FromClause schema params left
958958 -- ^ left
959− -> FromClause schema params (Join left (NullifyRelations right))
959+ -> FromClause schema params (Join left (NullifyFrom right))
960960leftOuterJoin right on left = UnsafeFromClause $
961961 renderFromClause left <+> "LEFT OUTER JOIN" <+> renderFromClause right
962962 <+> "ON" <+> renderExpression on
@@ -974,7 +974,7 @@ rightOuterJoin
974974 -- ^ @on@ condition
975975 -> FromClause schema params left
976976 -- ^ left
977− -> FromClause schema params (Join (NullifyRelations left) right)
977+ -> FromClause schema params (Join (NullifyFrom left) right)
978978rightOuterJoin right on left = UnsafeFromClause $
979979 renderFromClause left <+> "RIGHT OUTER JOIN" <+> renderFromClause right
980980 <+> "ON" <+> renderExpression on
@@ -994,7 +994,7 @@ fullOuterJoin
994994 -> FromClause schema params left
995995 -- ^ left
996996 -> FromClause schema params
997− (Join (NullifyRelations left) (NullifyRelations right))
997+ (Join (NullifyFrom left) (NullifyFrom right))
998998fullOuterJoin right on left = UnsafeFromClause $
999999 renderFromClause left <+> "FULL OUTER JOIN" <+> renderFromClause right
10001000 <+> "ON" <+> renderExpression on
squeal-postgresql/src/Squeal/PostgreSQL/Schema.hs+13−19
@@ -98,12 +98,11 @@ module Squeal.PostgreSQL.Schema
9898 , AllNotNull
9999 , NotAllNull
100100 , NullifyType
101− , NullifyRelation
102− , NullifyRelations
101+ , NullifyRow
102+ , NullifyFrom
103103 , ColumnsToRow
104104 , TableToColumns
105105 , TableToRow
106− , RelationToNullityTypes
107106 , ConstraintInvolves
108107 , DropIfConstraintsInvolve
109108 -- ** JSON support
@@ -564,29 +563,24 @@ type family NotAllNull (columns :: ColumnsType) :: Constraint where
564563 NotAllNull (column ::: def :=> 'NotNull ty ': columns) = ()
565564 NotAllNull (column ::: def :=> 'Null ty ': columns) = NotAllNull columns
566565
567−-- | `NullifyType` is an idempotent that nullifies a `ColumnType`.
566+-- | `NullifyType` is an idempotent that nullifies a `NullityType`.
568567type family NullifyType (ty :: NullityType) :: NullityType where
569568 NullifyType ('Null ty) = 'Null ty
570569 NullifyType ('NotNull ty) = 'Null ty
571570
572−-- | `NullifyRelation` is an idempotent that nullifies a `ColumnsType`.
573−type family NullifyRelation (columns :: RowType) :: RowType where
574− NullifyRelation '[] = '[]
575− NullifyRelation (column ::: ty ': columns) =
576− column ::: NullifyType ty ': NullifyRelation columns
571+-- | `NullifyRow` is an idempotent that nullifies a `RowType`.
572+type family NullifyRow (columns :: RowType) :: RowType where
573+ NullifyRow '[] = '[]
574+ NullifyRow (column ::: ty ': columns) =
575+ column ::: NullifyType ty ': NullifyRow columns
577576
578−-- | `NullifyRelations` is an idempotent that nullifies a `FromType`
577+-- | `NullifyFrom` is an idempotent that nullifies a `FromType`
579578-- used to nullify the left or right hand side of an outer join
580579-- in a `Squeal.PostgreSQL.Query.FromClause`.
581−type family NullifyRelations (tables :: FromType) :: FromType where
582− NullifyRelations '[] = '[]
583− NullifyRelations (table ::: columns ': tables) =
584− table ::: NullifyRelation columns ': NullifyRelations tables
585−
586−-- | `RelationToNullityTypes` drops the column constraints.
587−type family RelationToNullityTypes (rel :: RowType) :: [NullityType] where
588− RelationToNullityTypes ('(k, x) : xs) = x : RelationToNullityTypes xs
589− RelationToNullityTypes '[] = '[]
580+type family NullifyFrom (tables :: FromType) :: FromType where
581+ NullifyFrom '[] = '[]
582+ NullifyFrom (table ::: columns ': tables) =
583+ table ::: NullifyRow columns ': NullifyFrom tables
590584
591585-- | `Join` is simply promoted `++` and is used in @JOIN@s in
592586-- `Squeal.PostgreSQL.Query.FromClause`s.