Skip to content

graftDecls stomps over too much #1516

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

Closed
isovector opened this issue Mar 7, 2021 · 0 comments · Fixed by #1543
Closed

graftDecls stomps over too much #1516

isovector opened this issue Mar 7, 2021 · 0 comments · Fixed by #1543
Assignees
Labels

Comments

@isovector
Copy link
Collaborator

Wingman test AutoThetaFix.hs replaces an instance method:

{-# LANGUAGE FlexibleContexts     #-}
{-# LANGUAGE UndecidableInstances #-}

data Fix f a = Fix (f (Fix f a))

instance ( Functor f
           -- FIXME(sandy): Unfortunately, the recursion tactic fails to fire
           -- on this case. By explicitly adding the @Functor (Fix f)@
           -- dictionary, we can get Wingman to generate the right definition.
         , Functor (Fix f)
         ) => Functor (Fix f) where
  fmap = _

but the result is:

{-# LANGUAGE FlexibleContexts     #-}
{-# LANGUAGE UndecidableInstances #-}

data Fix f a = Fix (f (Fix f a))
instance (Functor f, Functor (Fix f)) => Functor (Fix f) where
  fmap fab (Fix fffa) = Fix (fmap (fmap fab) fffa)

Maybe what I really want here is a graftHsMatch, rather than the whole decl.

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

Successfully merging a pull request may close this issue.

1 participant