Skip to content

Coercible solver incomplete with recursive newtypes

The following module fails to compile due to infinite recursion:

import Data.Coerce

newtype Bar a = Bar (Either a (Bar a))
newtype Age = MkAge Int

x :: Bar Age
x = coerce (Bar (Left (5 :: Int)))

It tries to coerce Bar Int to Bar Age. This is clearly doable, via tyconapp decomposition. But we don't find it. Before worrying too much about it, though, we'll wait for a real example.

Do speak up if this problem is ruining your day!

Trac metadata
Trac field Value
Version 7.10.1-rc3
Type Bug
TypeOfFailure OtherFailure
Priority low
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