summaryrefslogtreecommitdiff
path: root/compiler/GHC/ThToHs.hs
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2022-04-06 18:55:11 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-04-07 12:57:59 -0400
commit02279a9c37deb34556834f706dbedc09258df753 (patch)
tree49875226385590fc2e25c6db224890ad374cc785 /compiler/GHC/ThToHs.hs
parent83363c8b04837ee871a304cf85207cf79b299fb0 (diff)
downloadhaskell-02279a9c37deb34556834f706dbedc09258df753.tar.gz
Rename [] to List (#21294)
This patch implements a small part of GHC Proposal #475. The key change is in GHC.Types: - data [] a = [] | a : [a] + data List a = [] | a : List a And the rest of the patch makes sure that List is pretty-printed as [] in various contexts. Updates the haddock submodule.
Diffstat (limited to 'compiler/GHC/ThToHs.hs')
-rw-r--r--compiler/GHC/ThToHs.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/GHC/ThToHs.hs b/compiler/GHC/ThToHs.hs
index 82f30c4757..194250aff8 100644
--- a/compiler/GHC/ThToHs.hs
+++ b/compiler/GHC/ThToHs.hs
@@ -57,6 +57,7 @@ import GHC.Utils.Panic
import qualified Data.ByteString as BS
import Control.Monad( unless, ap )
+import Control.Applicative( (<|>) )
import Data.Maybe( catMaybes, isNothing )
import Language.Haskell.TH as TH hiding (sigP)
import Language.Haskell.TH.Syntax as TH
@@ -2107,9 +2108,10 @@ thRdrName loc ctxt_ns th_occ th_name
thOrigRdrName :: String -> TH.NameSpace -> PkgName -> ModName -> RdrName
thOrigRdrName occ th_ns pkg mod =
let occ' = mk_occ (mk_ghc_ns th_ns) occ
- in case isBuiltInOcc_maybe occ' of
+ mod' = mkModule (mk_pkg pkg) (mk_mod mod)
+ in case isBuiltInOcc_maybe occ' <|> isPunOcc_maybe mod' occ' of
Just name -> nameRdrName name
- Nothing -> (mkOrig $! (mkModule (mk_pkg pkg) (mk_mod mod))) $! occ'
+ Nothing -> (mkOrig $! mod') $! occ'
thRdrNameGuesses :: TH.Name -> [RdrName]
thRdrNameGuesses (TH.Name occ flavour)