Skip to content

Type checker fails to unify/expand type definitions in certain contexts

When compiling

type TMvar a = TVar (Maybe a) mynewEmptyMvar :: STM (TMVar a) mynewEmptyMvar = newTVar Nothing

the type checker complains

Couldn't match expected type TMVar a' against inferred type TVar (Maybe a1)'

Expected type: STM (TMVar a)

Inferred type: STM (TVar (Maybe a1))

In the expression: newTVar Nothing

In the definition of `mynewEmptyMvar':

mynewEmptyMvar = newTVar Nothing

although the definition of TMvar is type TMvar a = TVar (Maybe a)

This behaviour could not be duplicated in the IO monad.

Trac metadata
Trac field Value
Version 6.10.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
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