#7217 closed bug (wontfix)

Unification of type variables in constraints

Reported by: sjoerd_visscher Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.6.1-rc1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

The following code works:

{-# LANGUAGE RankNTypes, ConstraintKinds, KindSignatures, GADTs #-}

import Data.Monoid
import GHC.Prim (Constraint)

data Dict :: Constraint -> * where
  Dict :: a => Dict a

f :: (c (), c String) => (forall a. Dict (c a) -> a) -> ((), String)
f g = (g Dict, g Dict)

test :: ((), String)
test = f g
  where
    g :: Dict (Monoid a) -> a
    g Dict = mempty

But this doesn't:

f :: (c (), c String) => (forall a. c a => a) -> ((), String)
f g = (g, g)

test :: ((), String)
test = f g
  where
    g :: Monoid a => a
    g = mempty

With the errors:

Could not deduce (c0 String, c0 ()) arising from a use of `f'

Could not deduce (Monoid a) arising from a use of `g'

So it seems that type variables in constraints are not unified. At first I thought this might not be easy to fix, but since there's a workaround I guess it should be possible.

Change History (1)

comment:1 Changed 23 months ago by sjoerd_visscher

  • Resolution set to wontfix
  • Status changed from new to closed

On second thought, it is perfect as it is.

Note: See TracTickets for help on using tickets.