id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
6134,Incorrect ambiguity error with functional dependencies,diatchki,,"GHC reject a program as ambiguous when it is not.  Consider the following example:
{{{
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleContexts #-}

class C a b | a -> b where
  f :: a -> b

test :: (Show a, C Int a) => Bool
test = show (f (1 :: Int)) == ""1""
}}}
GHC rejects the program with the following error:
{{{
    Ambiguous constraint `C Int a'
      At least one of the forall'd type variables mentioned by the constraint
      must be reachable from the type after the '=>'
    In the type signature for `test': test :: (Show a, C Int a) => Bool
}}}

The only variable, {{{a}}}, is fully determined by the type `Int` via the functional dependency on class `C` so there is no ambiguity.

These sort of errors crop up when we desugar implicit parameters into uses of the `IP` class (which has a functional dependency).  ",bug,closed,normal,,Compiler (Type checker),7.4.1,fixed,,,Unknown/Multiple,Unknown/Multiple,GHC rejects valid program,Unknown,typecheck/should_compile/T6134,,,
