<div dir="ltr"><div><div><div>Hi Jacques,<br></div>I thought about that, but I wasn't able to push it further.<br></div>It would look like that:<br><span style="font-family:courier new,monospace"><br></span></div><span style="font-family:courier new,monospace">> data Effect = Effect</span><br>
<div><div><div><br><div class="gmail_extra"><span style="font-family:courier new,monospace">> data
Exp e a where<br>
> ReadAccount :: Exp () Int<br>
> WriteAccount :: Exp () Int -> Exp Effect () <br>
> SetVictory :: Exp () Bool -> Exp Effect ()<br>
> OnTimer :: Exp Effect () -> Exp Effect ()<br>
</span><br></div><div class="gmail_extra">Is that right? Should <span style="font-family:courier new,monospace">Exp ()</span> <span style="font-family:courier new,monospace"></span>and<span style="font-family:courier new,monospace"> Exp Effect</span> belong to two different monads?<br>
</div><div class="gmail_extra">I was thinking of monad transformers to bridge between the two...<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 28, 2014 at 1:29 PM, Jacques Carette <span dir="ltr"><<a href="mailto:carette@mcmaster.ca" target="_blank">carette@mcmaster.ca</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 bgcolor="#FFFFFF" text="#000000">
<div>The simplest way would be to add a
phantom type parameter to Exp, i.e.<br>
data Exp e a where<br>
<br>
The 'e' variable would be used to track (and propagate) effects.
It is then up to you to design your 'effect system' as you wish.<span class=""><font color="#888888"><br>
<br>
Jacques</font></span><div class="im"><br>
<br>
On 2014-01-28 6:03 AM, Corentin Dupont wrote:<br>
</div></div><div class="im">
<blockquote type="cite">
<div dir="ltr">
<div>
<div>
<div>-> In short, my question is: how can I semantically
separate instructions with effect from the others? i.e.
how can I mark down and track those effects?<br>
</div>
</div>
</div>
</div>
</blockquote>
<br>
</div><div class="im"><blockquote type="cite">
<div dir="ltr">
<div>
<div>
<div>This is the DSL:<br>
<br>
<span style="font-family:courier new,monospace">> data
Exp a where<br>
> ReadAccount :: Exp Int<br>
> WriteAccount :: Exp Int -> Exp () <br>
> SetVictory :: Exp Bool -> Exp ()<br>
> OnTimer :: Exp () -> Exp ()<br>
> Return :: a -> Exp a<br>
> Bind :: Exp a -> (a -> Exp b) ->
Exp b</span><br>
<br>
</div>
</div>
</div>
</div>
</blockquote>
<br>
</div></div>
</blockquote></div><br></div></div></div></div></div>