HaRe and incremental type checking / type inference

AlanKim Zimmerman alan.zimm at gmail.com
Wed Jul 9 20:35:35 UTC 2014


I have hit a problem in HaRe when lifting a declaration from e.g. a where
clause of a function to the top level, where there is a type signature of
any complexity.

e.g lifting 'baz' from function 'foo' below

--------------------------
foo a = baz
  where
    baz :: Int
    baz = xx 1 a

    xx :: (Num t) => t -> t -> t
    xx p1 p2 = p1 + p2
--------------------------------------

becomes

---------------------------------------------
foo a = (baz xx a)
  where
    xx :: (Num t) => t -> t -> t
    xx p1 p2 = p1 + p2

-- baz:: (forall t. Num t => t -> t -> t) -> Int ->Int
baz :: Num a => (a -> t1 -> t) -> t1 -> t
baz xx a= xx 1 a
-----------------------------------------------

For a very small subset this can be calculated easily, but for full
generality it would be great to access the full power of the GHC type
system.

So before diving in too deeply, I thought I would test the waters as to the
feasibility of doing something like this. I was hoping that perhaps the
effort at an external constraint solver might be making the interfacing
slightly simpler.

Regards
 Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20140709/027f09a3/attachment-0001.html>


More information about the ghc-devs mailing list