Skip to content

Unexpected result from functional dependency typechecking

Summary

The following does not typecheck, despite being fully unambiguous and trivial to manually decide:

{-# LANGUAGE
  FunctionalDependencies
#-}

class Inspect a b | a -> b
instance Inspect Int Bool

bad :: Inspect Int b => b
bad = True

=>


Couldn’t match expected type `b` with actual `Bool`

Expected behaviour

That the given should typecheck.

Environment

  • GHC version used: 9.6.2
Edited by j
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information