-->

See implicit exports from a Module

2019-07-04 12:08发布

问题:

Quite surprisingly, I'm trying to fix a compilation warning missing-export-lists by adding explicitly the elements imported one by one for a specific module, but somehow there is something magical that this module is implicitly exporting that I can't find....

is it possible to retrieve what is exported implicitly with ghc ?

Here is an example of my issue, Yesod is generating some code with TH and quasiquotes :

{-# LANGUAGE EmptyDataDecls             #-}
{-# LANGUAGE FlexibleContexts           #-}
{-# LANGUAGE GADTs                      #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses      #-}
{-# LANGUAGE OverloadedStrings          #-}
{-# LANGUAGE QuasiQuotes                #-}
{-# LANGUAGE TemplateHaskell            #-}
{-# LANGUAGE TypeFamilies               #-}
import           Control.Monad.IO.Class  (liftIO)
import           Database.Persist
import           Database.Persist.Sqlite
import           Database.Persist.TH

share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase|
Person
    name String
    age Int Maybe
    deriving Show
|]

Then let's say we use that generated code that way :

people <- selectList
    (       [PersonAge >. 25, PersonAge <=. 30]
        ||. [PersonName /<-. ["Adam", "Bonny"]]
        ||. ([PersonAge ==. 50] ||. [PersonAge ==. 60])
    )
    []
liftIO $ print people

Now I want to put share in a specific module and control precisely what I'm exporting from that code generated.

I don't know how it generates PersonName and PersonAge ! I don't how to specifically import these 2 types for example...