squeal-postgresql 0.8.1.0 → 0.8.1.1
raw patch · 2 files changed
+6/−5 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Squeal.PostgreSQL.Type.Alias: type MismatchError (alias :: Symbol) (fields :: [(Symbol, kind)]) (found :: kind) (expected :: kind) = MismatchError' (MismatchError' () (DefaultPrettyPrinter fields) alias fields found expected) (PrettyPrintHaystack fields) alias fields found expected
- Squeal.PostgreSQL.Type.Alias: type family PrettyPrintHaystack (haystack :: [(Symbol, k)]) :: PrettyPrintInfo
+ Squeal.PostgreSQL.Type.Alias: type family MismatchError (alias :: Symbol) (fields :: [(Symbol, kind)]) (found :: kind) (expected :: kind) :: Constraint
Files
squeal-postgresql.cabal view
@@ -1,5 +1,5 @@ name: squeal-postgresql-version: 0.8.1.0+version: 0.8.1.1 synopsis: Squeal PostgreSQL Library description: Squeal is a type-safe embedding of PostgreSQL in Haskell homepage: https://github.com/morphismtech/squeal
src/Squeal/PostgreSQL/Type/Alias.hs view
@@ -217,15 +217,16 @@ ) => HasErr allFields alias '[] field -- | @MismatchError@ reports a nicer error with more context when we successfully do a lookup but--- find a different field than we expected-type MismatchError (alias :: Symbol) (fields :: [(Symbol, kind)]) (found :: kind) (expected :: kind)- = MismatchError' (MismatchError' () (DefaultPrettyPrinter fields) alias fields found expected) (PrettyPrintHaystack fields) alias fields found expected+-- find a different field than we expected. As a type family, it ensures that we only do the (expensive)+-- calculation of coming up with our pretty printing information when we actually have a mismatch+type family MismatchError (alias :: Symbol) (fields :: [(Symbol, kind)]) (found :: kind) (expected :: kind) :: Constraint where+ MismatchError _ _ found found = ()+ MismatchError alias fields found expected = MismatchError' (MismatchError' () (DefaultPrettyPrinter fields) alias fields found expected) (PrettyPrintHaystack fields) alias fields found expected -- | @MismatchError'@ is the workhorse behind @MismatchError@, but taking an additional type as the first argument. We can put another type error -- in there which will only show if @MismatchError'@ is stuck; this allows us to fall back to @DefaultPrettyPrinter@ when a @PrettyPrintHaystack@ instance -- is missing type family MismatchError' (err :: Constraint) (ppInfo :: PrettyPrintInfo) (alias :: Symbol) (fields :: [(Symbol, kind)]) (found :: kind) (expected :: kind) :: Constraint where- MismatchError' _ _ _ _ found found = () MismatchError' _ ('PrettyPrintInfo needleName haystackName _) alias fields found expected = TypeError ( 'Text "Type mismatch when looking up " ':<>: needleName ':<>: 'Text " named " ':<>: 'ShowType alias ':$$: 'Text "in " ':<>: haystackName ':<>: 'Text ":"