Skip to content

graftDecls stomps over too much #1516

Closed
@isovector

Description

@isovector

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions