Oleg: Very interresting, thanks. I have some questions: - What do you mean by "The type Cont Int a describes an impure computation, which may
abort with an Int value, for example".
Aborting with an Int value is akin to exceptions?
- for me it's not clear when to choose an "applicative" or a "monadic" DSL? Betsides, what's the rational behind the name "let_" (never seen it before)?
Linsey, Jacques: Thanks for the pointer! I learned about data kinds. I tried to apply your suggestions to add a phantom type parameter to Exp.
I came up to (I dropped the Free monad idea, which seems unrelated to the problem): > data Eff = Effect | NoEffect
> -- first type parameter is used to track effects
> data Exp :: Eff -> * -> * where
> ReadAccount :: Exp r Int --ReadAccount can be used in whatever monad (with or without effect) > WriteAccount :: Exp NoEffect Int -> Exp Effect () --WriteAccount takes an effect-less expression, and returns an effectfull expression
> SetVictory :: Exp NoEffect Bool -> Exp Effect () -- same for SetVictory > OnTimer :: Exp Effect () -> Exp Effect () --OnTime can program whatever expression to be triggered every minutes, in particular effectful ones
> Return :: a -> Exp r a > Bind :: Exp r a -> (a -> Exp r b) -> Exp r b