Skip to content

The GHCi `:print` command doesn't respect the flag `-f(no-)print-explicit-foralls`.

Summary

The GHCi :print command doesn't respect the flag -f(no-)print-explicit-foralls.

Steps to reproduce

$ ghchead --interactive
GHCi, version 9.1.20210210: https://www.haskell.org/ghc/  :? for help
ghci> :set -fprint-explicit-foralls
ghci> :print foldl
foldl = (_t1::forall b a.
              Foldable t =>
              (b -> a -> b) -> b -> t a -> b)
ghci> :t foldl
foldl
  :: forall (t :: * -> *) b a.
     Foldable t =>
     (b -> a -> b) -> b -> t a -> b
ghci> :set -fno-print-explicit-foralls
ghci> :print foldl
foldl = (_t2::forall b a.
              Foldable t =>
              (b -> a -> b) -> b -> t a -> b)
ghci> :t foldl
foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b

Expected behavior

The print command should respect the -f(no-)print-explicit-foralls flag. The output of :print should be consistent with the output of :type!

When -fprint-explicit-foralls is NOT set, then the output of :print foldl shouldn't show the forall constraint.

Additional note:

Ticket #12449 (closed) is the reason for the difference between :print and :type in the case when -fprint-explicit-foralls is set.

Environment

  • GHC version used: HEAD 9.1 from 2021-02-10

Optional:

  • Operating System: Debian 10
  • System Architecture: x86_64
Edited by Roland Senn
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information