summaryrefslogtreecommitdiff
path: root/compiler/parser/RdrHsSyn.hs
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2019-02-14 00:36:00 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-02-15 07:29:05 -0500
commit887454d8889ca5dbba70425de41d97939cb9ac60 (patch)
tree6d7d57ee977f58fcceed0d59a95bcfdf057551dc /compiler/parser/RdrHsSyn.hs
parentb31df5caaebb1c4f72a3c70a9cdb7893af4c3309 (diff)
downloadhaskell-887454d8889ca5dbba70425de41d97939cb9ac60.tar.gz
'forall' always a keyword, plus the dot type operator
Diffstat (limited to 'compiler/parser/RdrHsSyn.hs')
-rw-r--r--compiler/parser/RdrHsSyn.hs25
1 files changed, 18 insertions, 7 deletions
diff --git a/compiler/parser/RdrHsSyn.hs b/compiler/parser/RdrHsSyn.hs
index 91a27e93e6..ddbd885576 100644
--- a/compiler/parser/RdrHsSyn.hs
+++ b/compiler/parser/RdrHsSyn.hs
@@ -71,6 +71,10 @@ module RdrHsSyn (
mkImpExpSubSpec,
checkImportSpec,
+ -- Token symbols
+ forallSym,
+ starSym,
+
-- Warnings and errors
warnStarIsType,
failOpFewArgs,
@@ -97,7 +101,7 @@ import TysWiredIn ( cTupleTyConName, tupleTyCon, tupleDataCon,
listTyConName, listTyConKey, eqTyCon_RDR,
tupleTyConName, cTupleTyConNameArity_maybe )
import ForeignCall
-import PrelNames ( forall_tv_RDR, allNameStrings )
+import PrelNames ( allNameStrings )
import SrcLoc
import Unique ( hasKey )
import OrdList ( OrdList, fromOL )
@@ -575,14 +579,10 @@ tyConToDataCon loc tc
= return (cL loc (setRdrNameSpace tc srcDataName))
| otherwise
- = Left (loc, msg $$ extra)
+ = Left (loc, msg)
where
occ = rdrNameOcc tc
-
msg = text "Not a data constructor:" <+> quotes (ppr tc)
- extra | tc == forall_tv_RDR
- = text "Perhaps you intended to use ExistentialQuantification"
- | otherwise = empty
mkPatSynMatchGroup :: Located RdrName
-> Located (OrdList (LHsDecl GhcPs))
@@ -959,7 +959,7 @@ checkTyClHdr is_cls ty
-- workaround to define '*' despite StarIsType
go lp (HsParTy _ (dL->L l (HsStarTy _ isUni))) acc ann fix
= do { warnStarBndr l
- ; let name = mkOccName tcClsName (if isUni then "★" else "*")
+ ; let name = mkOccName tcClsName (starSym isUni)
; return (cL l (Unqual name), acc, fix, (ann ++ mkParensApiAnn lp)) }
go l (HsTyVar _ _ (dL->L _ tc)) acc ann fix
@@ -2345,3 +2345,14 @@ mkLHsDocTy t doc =
mkLHsDocTyMaybe :: LHsType GhcPs -> Maybe LHsDocString -> LHsType GhcPs
mkLHsDocTyMaybe t = maybe t (mkLHsDocTy t)
+
+-----------------------------------------------------------------------------
+-- Token symbols
+
+starSym :: Bool -> String
+starSym True = "★"
+starSym False = "*"
+
+forallSym :: Bool -> String
+forallSym True = "∀"
+forallSym False = "forall"