{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreigezxtve4o7wweqgx4qfiqckf7ojs2xdcyl3ixb4ujzuzy57bfbzi",
"uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mot4k4ccoux2"
},
"path": "/t/error-ghc-91510-illegal-polymorphic-type/14304#post_7",
"publishedAt": "2026-06-21T18:22:46.000Z",
"site": "https://discourse.haskell.org",
"textContent": "With enough type-class synonyms\n\n\n class Objects cat x => ObjectClass cat x\n instance Objects cat x => ObjectClass cat x\n\n class (forall x. f x => g x) => f ==> g\n instance (forall x. f x => g x) => f ==> g\n infix 2 ==>\n\n class f (g x) => (f . g) x\n instance f (g x) => (f . g) x\n\n\nand a few tweaks to your implementation (which I _think_ are fixes)\n\n\n type Transform ::\n (k -> k -> Type) ->\n (j -> k) ->\n (j -> k) ->\n Type\n newtype Transform cat f g = Transform\n {transform :: forall x. Objects cat x => cat (f x) (g x)}\n\n instance (Category cat) => Category (Transform cat) where\n type Objects (Transform cat) f = ObjectClass cat ==> ObjectClass cat . f\n id = Transform id\n Transform g_h . Transform f_g = Transform (g_h . f_g)\n\n\nall looks to be well.",
"title": "Error GHC-91510: illegal polymorphic type"
}