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

A curious case with Where #94

Open
hafizhmakmur opened this issue May 20, 2020 · 3 comments
Open

A curious case with Where #94

hafizhmakmur opened this issue May 20, 2020 · 3 comments

Comments

@hafizhmakmur
Copy link

I was trying to figure out how to make my code safe and then I try to isolate the problem when I stumbled upon a curious case.

I make this code and it's unsafe as expected. But then I try to tinker around the code and it results in this code which is safe! Eventhough aaaa actually doesn't change at all, adding an irrelevant function which just so happens to have an exact definition with the function in Where in aaaa makes it safe somehow.

I eventually found out that you need to make a specification also for the function defined in Where (in this case {-@ test :: (Ord a, Num a) => x:a -> {y:Bool | y <=> (x > 0)} @-}) to make the function passed safe but this particular case still seems like an odd behavior to me.

@ranjitjhala
Copy link
Member

ranjitjhala commented May 20, 2020 via email

@rosekunkel
Copy link

In the safe variant, test gets inlined.

@ranjitjhala
Copy link
Member

ranjitjhala commented May 26, 2020 via email

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

No branches or pull requests

3 participants