<div dir="ltr">I think the first time I saw a connection to polymorphic recursion was in Neil Mitchell's supero, which used it as a catch-all fallback plan.<div><br></div><div><a href="http://community.haskell.org/~ndm/downloads/slides-haskell_with_go_faster_stripes-30_nov_2006.pdf">http://community.haskell.org/~ndm/downloads/slides-haskell_with_go_faster_stripes-30_nov_2006.pdf</a><br>
<div><br></div><div>-Edward</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 19, 2014 at 4:49 PM, Conal Elliott <span dir="ltr"><<a href="mailto:conal@conal.net" target="_blank">conal@conal.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks, Ed. It hadn't occurred to me that defunctionalization might be useful for monomorphization. Do you know of a connection?<br>
<br>I'm using a perfect leaf tree type similar to the one you mentioned but indexed by depth:<br>

<br>> data Tree :: (* -> *) -> Nat -> * -> * where<br>>   L :: a -> Tree k 0 a<br>>   B :: Tree k n (k a) -> Tree k (1+n) a<br><br>Similarly for "top-down" perfect leaf trees:<br><br>

> data Tree :: (* -> *) -> Nat -> * -> * where<br>
>   L :: a -> Tree k 0 a<br>>   B :: k (Tree k n a) -> Tree k (1+n) a<br><br>This way, after monomorphization, there won't be any sums remaining.<span class="HOEnZb"><font color="#888888"><br><br>  -- Conal</font></span><div>
<div class="h5"><br><br><div class="gmail_extra"><br><div class="gmail_quote">

On Thu, Jun 19, 2014 at 1:22 PM, Edward Kmett <span dir="ltr"><<a href="mailto:ekmett@gmail.com" target="_blank">ekmett@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Might you have more success with a Reynolds style defunctionalization pass for the polymorphic recursion you can't eliminate? <div>





<br></div><div>Then you wouldn't have to rule out things like<div><br>
</div><div><font face="courier new, monospace">data Complete a = S (Complete (a,a)) | Z a<br></font><div><br></div><div>which don't pass that test.</div><div><br></div><div>-Edward</div></div></div></div><div class="gmail_extra">






<br><br><div class="gmail_quote"><div>On Thu, Jun 19, 2014 at 3:28 PM, Conal Elliott <span dir="ltr"><<a href="mailto:conal@conal.net" target="_blank">conal@conal.net</a>></span> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div>
<div dir="ltr"><div>Has anyone worked on a monomorphizing transformation for GHC Core? I understand that polymorphic recursion presents a challenge, and I do indeed want to work with polymorphic recursion but only on types for which the recursion bottoms out statically (i.e., each recursive call is on a smaller type). I'm aiming at writing high-level polymorphic code and generating monomorphic code on unboxed values. This work is part of a project for compiling Haskell to hardware, described on my blog (<a href="http://conal.net" target="_blank">http://conal.net</a>).<br>








<br></div>Thanks,  - Conal<br></div>
<br></div>_______________________________________________<br>
Glasgow-haskell-users mailing list<br>
<a href="mailto:Glasgow-haskell-users@haskell.org" target="_blank">Glasgow-haskell-users@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/glasgow-haskell-users" target="_blank">http://www.haskell.org/mailman/listinfo/glasgow-haskell-users</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>