<div dir="ltr"><br><div class="gmail_extra">On Tue, Feb 19, 2013 at 9:28 PM, Anton Kholomiov <span dir="ltr"><<a href="mailto:anton.kholomiov@gmail.com" target="_blank">anton.kholomiov@gmail.com</a>></span> wrote:<br>
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br><div class="gmail_quote"><div class="im"><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"><div>Do you think the approach can be extended for non-regular (nested) algebraic types (where the recursive data type is sometimes at a different type instance)? For instance, it's very handy to use GADTs to capture embedded language types in host language (Haskell) types, which leads to non-regularity.<span><font color="#888888"><br>
<br></font></span></div></div></blockquote></div><div><br>I'm not sure I understand the case you are talking about. Can you write a simple example<br>of the types like this?<br></div></div></blockquote><div><br></div>
<div>Here's an example of a type-embedded DSEL, represented as a GADT:<br></div><div><br>> data E :: * -> * where<br>> Lit :: Show a => a -> E a<br>> Op :: Op a -> E a<br>> App :: E (a -> b) -> E a -> E b<br>
> ...<br>> <br>> data Op :: * -> * where<br>> Add :: Num a => E (a -> a -> a)<br>> Mul :: Num a => E (a -> a -> a)<br>> Neg :: Num a => E (a -> a)<br>> ...<br><br>
</div></div>-- Conal<br></div></div>