Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kind occurrence check deferred to the object definition. #258

Open
Heimdell opened this issue Feb 2, 2016 · 2 comments
Open

Kind occurrence check deferred to the object definition. #258

Heimdell opened this issue Feb 2, 2016 · 2 comments

Comments

@Heimdell
Copy link

Heimdell commented Feb 2, 2016

The next code compiles fine:

module hello.HelloWorld where

type Omega s = s s

data Cons a b = Cons a b

type Stream a = Omega (Cons a)

--infinite :: a -> Stream a
--infinite x = Cons x (infinite x)

data Const a b = Const { getConst :: a }

although, Omega type should clearly produce a "cyclic kind" error.

If we uncomment the infinite function, then compiler complains on Stream type.

GHC will yell on the Omega itself, which is the best behaviour for me.

@Ingo60
Copy link
Member

Ingo60 commented Feb 2, 2016

Yes, currently the compiler only checks that the type definitions don't construct cycles. As long as you don't use them, you can write utter nonsense on the RHS.

Ingo60 added a commit that referenced this issue Mar 18, 2016
@Ingo60
Copy link
Member

Ingo60 commented Mar 30, 2018

To solve this, a more advanced kind inference is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants