Repro case for redundant constraint bug.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: | |
ghc --version | |
ghc -Wredundant-constraints -Werror -O0 Main.hs | |
ghc -Wredundant-constraints -Werror -O2 Main.hs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
make | |
ghc --version | |
The Glorious Glasgow Haskell Compilation System, version 8.10.2 | |
ghc -Wredundant-constraints -Werror -O0 Main.hs | |
Loaded package environment from /home/nicuveo/.ghc/x86_64-linux-8.10.2/environments/default | |
[1 of 1] Compiling Main ( Main.hs, Main.o ) | |
Linking Main ... | |
ghc -Wredundant-constraints -Werror -O2 Main.hs | |
Loaded package environment from /home/nicuveo/.ghc/x86_64-linux-8.10.2/environments/default | |
[1 of 1] Compiling Main ( Main.hs, Main.o ) [flags changed] | |
Main.hs:12:1: error: [-Wredundant-constraints, -Werror=redundant-constraints] | |
• Redundant constraint: Show Int | |
• In the type signature for: | |
foo :: Show Int => Int -> IO () | |
| | |
12 | foo :: Show Int => Int -> IO () | |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
make: *** [Makefile:4: all] Error 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeFamilies #-} | |
module Main where | |
bar :: forall a. Show a => a -> IO () | |
bar = print | |
foo :: Show Int => Int -> IO () | |
foo = bar | |
main :: IO () | |
main = foo 42 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can repro on the 9.1.20201218 ghc I'm using too