<div dir="ltr"><div><div>Basically I want to be able to make a few small changes to an already type checked AST and then query the type system, similar to what is possible with typed holes.<br><br></div>So in my example I would like to move baz to the top level, and then invoke the type checker to get the required signature, without having to convert the partial result back to source and re-run the entire compilation.<br>

<br></div>Alan<br><div><br><div><br><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jul 13, 2014 at 10:21 PM, Richard Eisenberg <span dir="ltr"><<a href="mailto:eir@cis.upenn.edu" target="_blank">eir@cis.upenn.edu</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello Alan,<br>
<br>
It's not clear what you're asking for here. What's keeping you from "accessing the full power of the GHC type system"?<br>
<br>
Richard<br>
<div><div class="h5"><br>
On Jul 9, 2014, at 4:35 PM, AlanKim Zimmerman <<a href="mailto:alan.zimm@gmail.com">alan.zimm@gmail.com</a>> wrote:<br>
<br>
> 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.<br>
><br>
> e.g lifting 'baz' from function 'foo' below<br>
><br>
> --------------------------<br>
> foo a = baz<br>
>   where<br>
>     baz :: Int<br>
>     baz = xx 1 a<br>
><br>
>     xx :: (Num t) => t -> t -> t<br>
>     xx p1 p2 = p1 + p2<br>
> --------------------------------------<br>
><br>
> becomes<br>
><br>
> ---------------------------------------------<br>
> foo a = (baz xx a)<br>
>   where<br>
>     xx :: (Num t) => t -> t -> t<br>
>     xx p1 p2 = p1 + p2<br>
><br>
> -- baz:: (forall t. Num t => t -> t -> t) -> Int ->Int<br>
> baz :: Num a => (a -> t1 -> t) -> t1 -> t<br>
> baz xx a= xx 1 a<br>
> -----------------------------------------------<br>
><br>
> 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.<br>
><br>
> 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.<br>


><br>
> Regards<br>
>  Alan<br>
><br>
</div></div>> _______________________________________________<br>
> ghc-devs mailing list<br>
> <a href="mailto:ghc-devs@haskell.org">ghc-devs@haskell.org</a><br>
> <a href="http://www.haskell.org/mailman/listinfo/ghc-devs" target="_blank">http://www.haskell.org/mailman/listinfo/ghc-devs</a><br>
<br>
</blockquote></div><br></div>