Closed Dretch closed 2 years ago
This sounds perfectly reasonable to me, but it might not be too useful in practice, because the underlying FoundationDB C library only allows you to set up one database connection per process. Thus, I don't think it's even possible to ever have more than one Database
in your program. So I'm curious why an Eq
instance would be useful to you.
Regardless of that caveat, I'd certainly accept the PR. Pointer equality for Database
equality sounds fine to me.
it might not be too useful in practice, because the underlying FoundationDB C library only allows you to set up one database connection per process.
Ah, this is true -- I had not thought about that.
So I'm curious why an Eq instance would be useful to you.
I have a data type containing a Database
and, since Eq
is not defined for Database
I had written an Eq MyDataType
instance that ignores the Database
field. I was thinking this was slightly hacky because the Database
values could actually be different: however, as you point out, this is not possible.
With that said, I think it would still be convenient to have an Eq Database
instance, since then one could use deriving (Eq)
rather than writing custom Eq
methods (or adding an orphan Eq Database
instance). So I will look at sending a PR for this.
Hi!
It would convenient for me if
Database
had anEq
instance defined. I imagine this would behave similarly toEq GHC.IO.Handle
- i.e. a particularDatabasePtr
would be equal only to itself, and then theEq
instance forDatabase
would be the obvious one.I suppose there may be some fundamental reason why this would not work, but I can't think of one.
If you consider this desirable, I will look into sending a PR.