Consider the following program (requires GHC 9.10):
{-# LANGUAGE ExplicitNamespaces, RequiredTypeArguments #-}
import Data.Functor.Compose
(@$?!) :: a -> forall f -> Applicative f => f a
a @$?! f = pure @f a
-- prints: Compose (Just (Just 1))
main :: IO ()
main = print $
1 @$?! (type (Compose Maybe Maybe))
Fun stuff! But using the type
herald in this way requires two sets of parentheses. This is a pity considering that one of the advantages of using a symbolic operator is that it often reduces the need for parentheses, if precedences are chosen wisely.
Would it be wise to consider changing how this use of type
is parsed to make one or both of these sets unnecessary? The outer set could be gotten rid of if 'type' atype
is also parsed as an exp10p
, and the inner set could be gotten rid of if the atype
in that production is changed to btype
. Neither change introduces any grammar conflicts, according to Happy. But are there other reasons not to propose them?