Em Qui, 2006-12-07 às 20:56 -0600, John Goerzen escreveu: > On Wed, Mar 07, 2007 at 07:26:25PM +0100, Marco Tulio Gontijo e Silva wrote: > > Hello John! > > > > I haven't noticed that instance SqlType (Maybe a), it's a workaround, > > but I still prefer the solution with my patch. In what do you consider > > that it could be harmful? The problem for me is just that filter (== > > The problem is that you convert a SQL NULL value to a string > "SqlNull". > > That string is indistinguishable from a field that contains the > literal string "SqlNull". That, in fact, is why the SQL NULL value is > not a string. It is specifically designed to be not representable as > a string, and trying to represent it as a string is an error.
I pointed out two solutions, and this one I told that it was worse because of this problem. I submitted a third solution latter, which was a problem in the first, better, solution. Here it goes again: [EMAIL PROTECTED]:~/dados/texto/codigo/haskell/hdbc/Database/HDBC$ diff -ruN Types.hs Types.2.hs --- Types.hs 2006-11-22 09:43:30.000000000 -0200 +++ Types.2.hs 2006-11-24 08:05:29.000000000 -0200 @@ -363,6 +363,8 @@ SqlEpochTime a == SqlEpochTime b = a == b SqlTimeDiff a == SqlTimeDiff b = a == b SqlNull == SqlNull = True + SqlNull == _ = False + _ == SqlNull = False a == b = ((fromSql a)::String) == ((fromSql b)::String) instance SqlType String where [EMAIL PROTECTED]:~/dados/texto/codigo/haskell/hdbc/Database/HDBC$ What's the problem of defining that SqlNull compared to other type is false? I know it's not strictly necessary, cause we can use fromSql, but i still think it's better to just compare with SqlNull without fromSql, don't you? -- malebria Marco Túlio Gontijo e Silva Jabber (Google Talk): [EMAIL PROTECTED] Correio (MSN): [EMAIL PROTECTED] Skype: marcotmarcot Telefone: 33346720 Celular: 98116720 Endereço: Rua Paula Cândido, 257/201 Gutierrez 3430-260 Belo Horizonte/MG Brasil