RequiredTypeArguments does not imply ExplicitForAll

I just don’t get it, is it a bug? The latter is necessitated by the former.

2 Likes

forall var. is invisible quantification, and forall var -> is visible quantification they are different things the fact they both use forall is immaterial the is no difference from the hypothetical case where ìnvisible quantification uses forallI var. and visible quantification uses forallV var. it is only a bug if you can’t write something like

{-# LANGUAGE RequiredTypeArguments #-}
import Foreign

mySizeOf :: forall s -> Storable s => Int
mySizeOf myType = sizeOf (undefined :: myType)

main :: IO ()
main = print $ mySizeOf Int

EDIT: nevermind if i use NoExplicitForAll it doesn’t compile which is a bug.

2 Likes

How can I get it fixed? Is there already a ticket?

ghc issues should be reported on the ghc gitlab Issues · Glasgow Haskell Compiler / GHC · GitLab

I think it’s fair to call this a bug.

It wasn’t caught during development because ExplicitForAll is included in GHC2021, which is the default nowadays, and you need to explicitly specify Haskell98 or Haskell2010 to observe the issue.

The patch to fix this should be trivial, would you like to submit one?

1 Like

Not really, I’m kind of scared of all things to you related after I tried to investigate how to make a plugin, I just wanted to bring it to someone’s attention.

Should I submit a patch? Or has it already been dealt with?

I’ve just checked and it hasn’t been dealt with. The steps to deal with this are:

  1. Create a ticket on GHC’s issue tracker
  2. Submit a patch to fix it:
    • modify impliedXFlags in compiler/GHC/Driver/Flags.hs
    • add a test case to testsuite/tests/vdq-rta/

The page contributing · Wiki · Glasgow Haskell Compiler / GHC · GitLab explains how to build GHC, test it, etc.

3 Likes