- 
                Notifications
    You must be signed in to change notification settings 
- Fork 14
          Create GCoercible class, analogous to GEq
          #46
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
8509f8a    to
    2915e7b      
    Compare
  
    GCoercible class, analogous to GEq --- contains #45
      46e2be8    to
    6570a3a      
    Compare
  
    It could be a superclass of `GEq`, but this would be a breaking change and interferes with Safe Haskell, so we refrained from making it one.
6570a3a    to
    dbafb11      
    Compare
  
    GCoercible class, analogous to GEq --- contains #45GCoercible class, analogous to GEq
      | gcoercible (InR x) (InR y) = gcoercible x y | ||
| gcoercible _ _ = Nothing | ||
|  | ||
| instance (GCoercible a, GCoercible b) => GCoercible (Product a b) where | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is weird (also in existing GEq instance. Either side would be enough, won't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh? It is possible for one to fail and the other to succeed, is it not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For TestEquality yes only one is sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was thinking of TestEquality, and it doesn't seem to have instance for Product so all is fine.
(btw, that's another point not to have TestEquality as a super-class for GEq).
| return Coercion | ||
|  | ||
| instance GCoercible IORef where | ||
| gcoercible x y = | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll be more welcome to add this and STRef instance if the implementation for this function were in base, and I could use Safe (or at least Trustworthy) interface. (This package takes Safe Haskell seriously for time being).
Turns out there is for heterogenous equality for StableName (eqStableName), so figuring out coercion based on STRef equality kind of belongs to base as well.
As maintainer I'll be happy if burden of tracking GHC internals is in GHC-provided lib.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just had the same thought. The unsafe function should be where the implementation is, as those must be kept in sync?
| N.B. would be subsumed by #67. | 
No description provided.