Opened 4 years ago

Closed 18 months ago

#11515 closed bug (fixed)

PartialTypeSignatures suggests a redundant constraint with constraint families

Reported by: goldfire Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.1
Keywords: TypedHoles Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: partial-sigs/should_fail/T11515
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

When I say

{-# LANGUAGE ConstraintKinds, TypeFamilies #-}

module Bug where

type family ShowSyn a where ShowSyn a = Show a

foo :: (ShowSyn a, _) => a -> String
foo x = show x

I get

Bug.hs:7:20: error:
    Found constraint wildcard ‘_’ standing for ‘Show a’
    To use the inferred type, enable PartialTypeSignatures
    In the type signature:
      foo :: (ShowSyn a, _) => a -> String

But if I fill in my wildcard with Show a, I'll rightly get a redundant constraint. Just a vanilla type synonym works there, but the type family causes trouble.

Change History (5)

comment:1 Changed 20 months ago by simonpj

Keywords: TypedHoles added

comment:2 Changed 18 months ago by RyanGlScott

This appears to be fixed, as of GHC 8.2.2:

$ /opt/ghc/8.2.2/bin/ghci Bug.hs
GHCi, version 8.2.2: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug              ( Bug.hs, interpreted )

Bug.hs:7:20: error:
    • Found type wildcard ‘_’ standing for ‘()’
      To use the inferred type, enable PartialTypeSignatures
    • In the type signature: foo :: (ShowSyn a, _) => a -> String
  |
7 | foo :: (ShowSyn a, _) => a -> String
  |                    ^

I'll add a regression test.

comment:3 Changed 18 months ago by simonpj

I'll add a regression test.

Thank you!

comment:4 Changed 18 months ago by Ryan Scott <ryan.gl.scott@…>

In 819b9cfd/ghc:

Add regression tests for #11515 and #12563

Happily, both of these issues appear to have been fixed in GHC 8.2.
Let's add regression tests for them to ensure that they stay fixed.

comment:5 Changed 18 months ago by RyanGlScott

Resolution: fixed
Status: newclosed
Test Case: partial-sigs/should_fail/T11515
Note: See TracTickets for help on using tickets.