Type inference can fail when newtypes are involved
Consider the following module Newtype
containing a single newtype
declaration.
newtype Foo a = Bar { foobar :: a }
When I try to compile this module with KiCS2, I get an error message.
kics2c: *** UserException: OccurCheck: Type variable a occurs in type Newtype.Foo
a during type inference for:
function Newtype.foobar
Changing the newtype
declaration as follows
newtype Foo a = Bar { foobar :: [a] }
results in another error message.
kics2c: *** UserException: Clash: [a] = Newtype.Foo a during type inference for:
function Newtype.foobar
Apparently, the type inference can fail when newtype
declarations are involved. However, it's likely that this issue arises in the front end where newtype
declarations are transformed into regular type
declarations.
Edited by Finn Teegen