Skip to content

Tactics plugin generates ill-typed term #565

Closed
@siraben

Description

@siraben

Given

import Data.Functor.Compose
data Fix f a = Fix (Compose f (Fix f) a)
instance Functor f => Functor (Fix f) where
  fmap f (Fix x) = _

We expect a program equivalent to the following to be synthesized.

instance Functor f => Functor (Fix f) where
  fmap f (Fix x) = Fix (fmap f x)

However the tactics engine produces

instance Functor f => Functor (Fix f) where
  fmap f (Fix x) = (case x of { (Compose x2) -> Compose x2 })

which is ill-typed.

stderr output
!!!goal: Judgement {_jHypothesis = fromList [(f,HyInfo {hi_provenance = UserPrv, hi_type = a -> b}),(x,HyInfo {hi_provenance = UserPrv, hi_type = Compose f (Fix f) a})], _jBlacklistDestruct = False, _jWhitelistSplit = True, _jIsTopHole = True, _jGoal = Fix f b}
!!!ctx: [(fmap,(a -> b) -> Fix f a -> Fix f b)]
!!!skolems: fromList [f,a,b]
!!!solns: [(known fmap
`- homo
   `- destruct x
      `- match Compose {x2}
         `- Compose
            `- assume x2
,case x of { (Compose x2) -> Compose x2 })]

Related to #561.
This has been tested as of commit 6c14163.

Metadata

Metadata

Assignees

No one assigned

    Labels

    can-workaroundcomponent: wingmantype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions