From 35d36d95c1c4192d99fee19f2cfdffaa92498fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Crist=C3=B3v=C3=A3o?= Date: Fri, 24 Apr 2015 16:22:43 +0100 Subject: [PATCH] GHC 7.10.1 support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without it, the following error occurs: ``` src/PgStructure.hs:88:5: Non type-variable argument in the constraint: Data.String.Conversions.ConvertibleStrings Text k (Use FlexibleContexts to permit this) When checking that ‘addFK’ has the inferred type addFK :: forall k. (Ord k, Data.String.Conversions.ConvertibleStrings Text k) => Map.Map k ForeignKey -> Column -> Column In an equation for ‘columns’: columns table = do { cols <- H.listEx $ (\ _1 _2 -> Hasql.Backend.Stmt "select info.table_schema as schema, info.table_name as table_name, info.column_name as name, info.ordinal_position as position, info.is_nullable as nullable, info.data_type as col_type, info.is_updatable as updatable, info.character_maximum_length as max_len, info.numeric_precision as precision, info.column_default as default_value, array_to_string(enum_info.vals, ',') as enum from ( select table_schema, table_name, column_name, ordinal_position, is_nullable, data_type, is_updatable, character_maximum_length, numeric_precision, column_default, udt_name from information_schema.columns where table_schema = ? and table_name = ? ) as info left outer join ( select n.nspname as s, t.typname as n, array_agg(e.enumlabel ORDER BY e.enumsortorder) as vals from pg_type t join pg_enum e on t.oid = e.enumtypid join pg_catalog.pg_namespace n ON n.oid = t.typnamespace group by s, n ) as enum_info on (info.udt_name = enum_info.n) order by position" (GHC.ST.runST (do { ... })) True) (qtSchema table) (qtName table); fks <- foreignKeys table; return $ map (addFK fks . columnFromRow) cols } where addFK fks col = col {colFK = Map.lookup (cs . colName $ col) fks} ``` Also, the regex-tdfa-text library needs a similar patch, but I didn't have time to contact the author yet. Cheers --- src/PgStructure.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/PgStructure.hs b/src/PgStructure.hs index 560f9c576..d9d226063 100644 --- a/src/PgStructure.hs +++ b/src/PgStructure.hs @@ -1,5 +1,6 @@ {-# LANGUAGE QuasiQuotes, OverloadedStrings, TypeSynonymInstances, - MultiParamTypeClasses, ScopedTypeVariables #-} + MultiParamTypeClasses, ScopedTypeVariables, + FlexibleContexts #-} module PgStructure where import PgQuery (QualifiedTable(..))