[Git][ghc/ghc][master] Make `identifier` parse unparenthesized `->` (#18060)

Marge Bot gitlab at gitlab.haskell.org
Wed May 27 04:15:28 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
d6203f24 by Joshua Price at 2020-05-27T00:15:17-04:00
Make `identifier` parse unparenthesized `->` (#18060)

- - - - -


4 changed files:

- compiler/GHC/Parser.y
- + testsuite/tests/ghci/T18060/T18060.script
- + testsuite/tests/ghci/T18060/T18060.stdout
- + testsuite/tests/ghci/T18060/all.T


Changes:

=====================================
compiler/GHC/Parser.y
=====================================
@@ -644,6 +644,8 @@ identifier :: { Located RdrName }
         | qconop                        { $1 }
     | '(' '->' ')'      {% ams (sLL $1 $> $ getRdrName funTyCon)
                                [mop $1,mu AnnRarrow $2,mcp $3] }
+    | '->'              {% ams (sLL $1 $> $ getRdrName funTyCon)
+                               [mu AnnRarrow $1] }
 
 -----------------------------------------------------------------------------
 -- Backpack stuff


=====================================
testsuite/tests/ghci/T18060/T18060.script
=====================================
@@ -0,0 +1,2 @@
+:i ->
+:i ~


=====================================
testsuite/tests/ghci/T18060/T18060.stdout
=====================================
@@ -0,0 +1,12 @@
+type (->) :: * -> * -> *
+data (->) a b
+  	-- Defined in ‘GHC.Prim’
+infixr -1 ->
+instance Applicative ((->) r) -- Defined in ‘GHC.Base’
+instance Functor ((->) r) -- Defined in ‘GHC.Base’
+instance Monad ((->) r) -- Defined in ‘GHC.Base’
+instance Monoid b => Monoid (a -> b) -- Defined in ‘GHC.Base’
+instance Semigroup b => Semigroup (a -> b) -- Defined in ‘GHC.Base’
+type (~) :: forall k. k -> k -> Constraint
+class (a ~ b) => (~) a b
+  	-- Defined in ‘GHC.Types’


=====================================
testsuite/tests/ghci/T18060/all.T
=====================================
@@ -0,0 +1 @@
+test('T18060', normal, ghci_script, ['T18060.script'])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d6203f24cf421749616a247c047a9b44192f963a

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d6203f24cf421749616a247c047a9b44192f963a
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200527/acaf39cd/attachment-0001.html>


More information about the ghc-commits mailing list