Closed sjakobi closed 6 years ago
Surprisingly, the .hi
-files seem to use the alias we want:
_Right :: Traversal (Either a b) (Either a b') b b'
Is this from show-hi?
Simon Jakobi notifications@github.com schrieb am Mo., 16. Juli 2018, 14:48:
Surprisingly, the .hi-files seem to use the alias we want:
_Right :: Traversal (Either a b) (Either a b') b b'
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sjakobi/haddock/issues/6#issuecomment-405236162, or mute the thread https://github.com/notifications/unsubscribe-auth/AByiif6rvQ4Sq1fxHyn3Ypo-wH-7Sm0Uks5uHIuVgaJpZM4VRCz4 .
Maybe something is expanding type synonyms in haddock.
Is this from show-hi?
That's how --show-iface
dumps the .hi
-file.
Using hiDecl
instead of generating the HsDecl
in mkDeclMap
doesn't seem to have caused this issue.
The problem seems to be somewhere in tyThingToLHsDecl
. The TyThing
we find in hiDecl
still has the alias according to pprTyThing showToIface
.
Aliases aren't expanded in every case:
{-# language RankNTypes #-}
module Lib where
type Traversal s t a b = forall f. Applicative f => (a -> f b) -> s -> f t
-- Fails
_Right :: Traversal (Either a b) (Either a b') b b'
_Right f (Right b) = Right <$> f b
_Right _ (Left a) = pure (Left a)
type Unit = ()
-- Works
x :: Unit
x = ()
Ugh, I know why this is happening. It's due to these lines in synifyType
:
In particular, this calls tcSplitSigmaTy
, which in turn invokes two functions (splitForAllTys
and tcSplitPredFunTy_maybe
) that expand type synonyms. This also explains why this doesn't affect type Unit = ()
, as this code is only ever called for types with a forall
at the front.
I'm not sure of a way to work around this other than developing a counterpart to tcSplitSigmaTy
that doesn't expand type synonyms...
Let's discuss this further at https://github.com/haskell/haddock/issues/879.
In
microlens
we currently generatefor what should be