TOTBWF / tactic-haskell

Tactic Metaprogramming in Haskell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`induction` doesn't properly handle polymorphic types

TOTBWF opened this issue · comments

Take this example:

data List a = Nil | Cons a (List a)
  deriving (Show)

tactic "sum'" [t| List Int -> Int |] $ do
  intro "x"
  induction "x"

Gives the error:

    Tactic Error: Unsolved Subgoals
              ===============
              GHC.Types.Int

              ind :: a_0
              ind1 :: GHC.Types.Int
              ===============
              GHC.Types.Int

The issue here is that ind :: a_0 is not unifying with Int.

After a bit of poking around, it seems that we have access to the instantiated type variables as a part of the Constructor pattern. However, I don't know how to unify the type variables in the reified constructors... Perhaps there is a way to reify (or something similar) in such a way that instantiates type variables?

Just fixed!