Skip to content

Unavoidable duplicate constraint warning

The "duplicate constraint" warning can be triggered in a context where it's impossible to remove it, because the constraints come with a type synonym.

The following standalone little module reproduces the problem:

{-# LANGUAGE FlexibleContexts, Rank2Types #-}

module Test where

type Constrained x y r = (Eq x, Eq y) => x -> y -> r
 
f :: Constrained String String ()
f = undefined

The warning is

Test.hs:7:6: Warning:
    Duplicate constraint(s): Eq String
    In the type signature for `f': f :: Constrained String String ()

The warning is present in 7.4.1 and 7.6.1, and presumably in the versions between as well.

Trac metadata
Trac field Value
Version 7.6.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information