-
Notifications
You must be signed in to change notification settings - Fork 72
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
Non-composability of GI.PangoCairo.fontMapGetDefault
and GI.PangoCairo.fontMapGetResolution
.
#77
Comments
GI.PangoCairo.fontMapGetDefault
and GI.PangoCairo.fontMapGetResolution
.GI.PangoCairo.fontMapGetDefault
and GI.PangoCairo.fontMapGetResolution
.
Exhibit: � GIPC.fontMapGetResolution =<< GIPC.fontMapGetDefault
<interactive>:36:1: error:
• Required ancestor ‘GIPC.FontMap’ not found for type ‘GIP.FontMap’.
• In the first argument of ‘(=<<)’, namely
‘GIPC.fontMapGetResolution’
In the expression:
GIPC.fontMapGetResolution =<< GIPC.fontMapGetDefault
In an equation for ‘it’:
it = GIPC.fontMapGetResolution =<< GIPC.fontMapGetDefault |
Thanks for the report. As far as I can tell the issue here is with the design of the original API, the generated bindings are accurate. The problem is that there are two closely related types:
λ> import qualified GI.PangoCairo as PC
λ> import Data.GI.Base (unsafeCastTo)
λ> PC.fontMapGetDefault >>= unsafeCastTo PC.FontMap >>= PC.fontMapGetResolution
96.0 I am using |
I don't think this is the entire information -- quoting the documentation:
..so while the source code might only be returning a generic So, there goes. And, actually, I doubt it's the only case in the API, where the documentation is more precise than the C-level types. And, given C's limitations, I guess we can all see the reason why the API providers are using the least common denominator.. |
Looking to the relevant pangocairo source, it is clear that you are completely right. The API is intended to return a Thanks again for the report! |
Thank you a lot, once again! |
According to https://hackage.haskell.org/package/gi-pangocairo-1.0.11/docs/src/GI-PangoCairo-Interfaces-FontMap.html#fontMapGetDefault :
..and..
..which, in absence of some kind of hard-to-figure-out casting, makes these functions non-composable.
The text was updated successfully, but these errors were encountered: