Hi Jacques,
I thought about that, but I wasn't able to push it further.
It would look like that:

> data Effect = Effect

> data Exp e a where
>   ReadAccount  :: Exp () Int
>   WriteAccount :: Exp () Int -> Exp Effect ()
>   SetVictory   :: Exp () Bool -> Exp Effect ()
>   OnTimer      :: Exp Effect () -> Exp Effect ()

Is that right? Should Exp () and Exp Effect belong to two different monads?
I was thinking of monad transformers to bridge between the two...


On Tue, Jan 28, 2014 at 1:29 PM, Jacques Carette <carette@mcmaster.ca> wrote:
The simplest way would be to add a phantom type parameter to Exp, i.e.
data Exp e a where

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.

Jacques


On 2014-01-28 6:03 AM, Corentin Dupont wrote:
-> 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?

This is the DSL:

> data Exp a where
>   ReadAccount  :: Exp Int
>   WriteAccount :: Exp Int -> Exp ()
>   SetVictory   :: Exp Bool -> Exp ()
>   OnTimer      :: Exp () -> Exp ()
>   Return       :: a -> Exp a
>   Bind         :: Exp a -> (a -> Exp b) -> Exp b