[Haskell-cafe] Type synonym involing quantified constraint?

Richard Eisenberg lists at richarde.dev
Tue Aug 31 18:09:17 UTC 2021

This looks like a bug, which I've now filed: https://gitlab.haskell.org/ghc/ghc/-/issues/20318

The workaround is to enable ImpredicativeTypes. Sadly, ImpredicativeTypes is really a bug in GHC 8.10, fixed to work properly in GHC 9.2. So if I were doing this, I would define the offending synonym in a module all by itself so that the scope of ImpredicativeTypes is as small as possible.


> On Aug 31, 2021, at 11:45 AM, Michael Sperber <sperber at deinprogramm.de> wrote:
> I'm working on Conal's ConCat code, and keep putting quantified
> constraints like this in instance constraints:
> (okk ~ Ok k, forall x y. (okk x, okk y) => okk (Prod k x y))
> (The okk ~ Ok k is necessary because Ok is an associated type.)
> Is there any way to define a type synonym for this?  Like
> type OkProd k = (okk ~ Ok k, forall x y. (okk x, okk y) => okk (Prod k x y))
> ghc (8.10.4) complains about an impredicative type.
> Help would be much appreciated!
> -- 
> Regards,
> Mike
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.

More information about the Haskell-Cafe mailing list