Skip to content

Function with type error accepted

The following program is accepted by ghc even though it is clearly wrong. The type family T is closed so T Bool cannot ever be reduced, so it must be a type error.

{-# LANGUAGE TypeFamilies #-}
module Err62 where

type family T a where
    T Int = ()

x :: T Bool
x = undefined

f :: T Bool -> Bool
f _ = True

y :: Bool
y = f x
Trac metadata
Trac field Value
Version 7.8.3
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