haddock
haddock copied to clipboard
How to tell from Haddocks whether a data type is a re-export?
I asked the below question in the Haskell subreddit and did not find a solution. Therefore I'm asking the same question here. Also, if the answer (as I expect) is "it's not possible", I hope someone can give an overview of the changes required to make it possible.
I'm trying to figure out whether it's possible to tell from Haddock documentation whether a given data type is a distinct type with the same name or a re-export of a type defined in another module.
For example, if I search for IO on Hoogle, the result for data IO a points to many different modules, e.g. the Hedgehog.Internal.Prelude module from the hedgehog package: https://hackage.haskell.org/package/hedgehog-1.2/docs/Hedgehog-Internal-Prelude.html#t:IO. As far as I can see, there is no way to tell, from the docs alone, that this type is a re-export of Prelude.IO. However, this must be the case since the following code typechecks:
import qualified Hedgehog.Internal.Prelude
test1 :: Hedgehog.Internal.Prelude.IO ()
test1 = (pure () :: Prelude.IO ())
If I, on the other hand, search for e.g. Query on Hoogle, I will get lots of data types called Query that are not the same, ie. not re-exports. For example:
- https://hackage.haskell.org/package/postgresql-simple-0.6.5/docs/Database-PostgreSQL-Simple.html#t:Query
- https://hackage.haskell.org/package/aws-0.24/docs/Aws-DynamoDb-Commands-Query.html#t:Query
Which means that the following will not typecheck:
import qualified Aws.DynamoDb.Commands.Query
import qualified Database.PostgreSQL.Simple
test2 :: Aws.DynamoDb.Commands.Query.Query
test2 = (undefined :: Database.PostgreSQL.Simple.Query)
Hence my question: given the Haddocks for two datatypes with the same name, is there a way to tell if they're the same?