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

make functor a generic class for #1619 #1621

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

make functor a generic class for #1619 #1621

wants to merge 1 commit into from

Conversation

nikivazou
Copy link
Member

So, in @rosekunkel 's example, the abstract refinement label was defaulted to true because Functor is not "generic", so no fresh type was created.

@rosekunkel this fixes your issue, but if you want to have similar behavior on other type classes, you should make a similar edit and add, e.g., applicative, monads, etc in the generic set, like I did.

@ranjitjhala I am not entirely sure that Functor (and the rest type constructors) are generic. It would be cool to formalize what generic means for such constructors. But the truth is, we are being too strict by not refreshing at all non generic types. I suspect we need to refresh the inner parts of the type (as here) but not the top level refinements.

Anyway, this should unblock Rose.

@ranjitjhala
Copy link
Member

ranjitjhala commented Feb 24, 2020 via email

@nikivazou
Copy link
Member Author

Good question :)
Did you try it?

@nikivazou
Copy link
Member Author

ok, @ranjitjhala you are suggesting to add an abstract refinement

  1. in a class method (I don't think we support that :) )[1]
  2. in a type variable for a type constructor (I don't think we support that either)[2]

I suggest, if this blocking Rose to hack isGeneric, otherwise properly fix it but this would need time.

[1] The following creates a parse error

{-@ class Functor f where
  fmap :: forall <p :: f -> Prop>. (a -> b) -> f a -> f b
  (<$) :: forall a b. a -> f b -> f a
  @-}

[2] The following creates a parse error

{-@   fmap'' :: forall <p :: f -> Bool>. (a -> b) -> (f<p>) a -> (f<p>) b @-}
fmap'' :: (a -> b) -> f a -> f b 
fmap''   = undefined

@ranjitjhala
Copy link
Member

ranjitjhala commented Feb 24, 2020 via email

@nikivazou
Copy link
Member Author

We still have problem number 2.

@ranjitjhala
Copy link
Member

@nikivazou why was this not merged in? (I can't tell by reading the comments but somehow this PR was closed?)

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

Successfully merging this pull request may close these issues.

2 participants