Skip to content

Functional dependencies regression

Testcase:

{-# LANGUAGE FlexibleInstances, UndecidableInstances, MultiParamTypeClasses, FunctionalDependencies #-}
module Foo where

class Mul x y z | x y -> z
class IsType a
class IsType a => IsSized a s | a -> s

data Array n a = Array
instance IsSized a s => IsType (Array n a)
instance (IsSized a s, Mul n s ns) => IsSized (Array n a) ns

ghc-7.0.0.20101014 rejects this with:

    Couldn't match type `s' with `s1'
      because this skolem type variable would escape: `s1'
    This skolem is bound by the instance declaration
    In the instance declaration for `IsSized (Array n a) ns'

ghc-7.0.0.20101005 and all previous versions accept it. This is from the llvm package, so is fairly critical.

Trac metadata
Trac field Value
Version 7.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