Em Seg, 2006-12-04 às 19:24 -0600, John Goerzen escreveu:
> On Wed, Nov 22, 2006 at 09:48:40AM -0200, Marco T?lio Gontijo e Silva wrote:
> > Package: libghc6-hdbc-dev
> > Version: 1.0.1.1
> > Severity: important
> > Tags: patch
> >
> > It's not possible to compare SqlNull to any other constructor of SqlType.
> >
> > Prelude Database.HDBC> SqlString "Marco" == SqlNull
> > *** Exception: fromSql: cannot convert SqlNull to String
> >
> > This is specially bad when I want to filter all the SqlNull from a list of
> > SqlTypes.
>
> Hello Marco,
>
> Thank you for reporting the bug. However, I believe that it is not a
> bug, and that your suggested fix could be harmful.
>
> The problem with converting a SQL NULL into a string is that you could
> have that string stored in SQL. You should really be comparing to a
> (Just String) or Nothing, as in:
>
> Prelude Database.HDBC> fromSql (SqlString "Marco") == "Marco"
> True
> Prelude Database.HDBC> fromSql (SqlString "Marco") == Nothing
> False
> Prelude Database.HDBC> fromSql SqlNull == Nothing
> True
> Prelude Database.HDBC> fromSql (SqlString "Marco") == Just "Marco"
> True
>
> My current plan is to close this bug without making a change, but I'd
> like to hear your response first.
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 (==
SqlNull) values will turn into filter ((== Nothing) . fromJust) values.
It's not a very big difference after it's written, but it is when you
don't know about instance SqlType (Maybe a). Maybe more documentation
about it would be sufficient.
Thanks.
--
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