Dear all,<div><br></div><div> I wanted to voice support for a partial type annotations. Here's my usage scenario: I have a monad for an imperative EDSL, which has an associated expression data type,</div><div><br></div>
<div>class (Monad m, Expression (ExprTyp m)) => MyDSLMonad m where</div><div> data ExprTyp m :: * -> *</div><div><br></div><div> and you write imperative EDSL code like so,</div><div><br></div><div>my_code_block = do</div>
<div> x <- instruction1</div><div> y <- instruction2 (x + x)</div><div> ...</div><div><br></div><div> I want the user to be able to annotate "x is an Integer". However, to do that now, one has to now add a type signature for my_code_block like so, so that the $m$ variable is in scope,</div>
<div><br></div><div>my_code_block :: forall m. MyDSLMonad m => m ()</div><div>my_code_block = do</div><div> x :: ExprTyp m Integer <- instruction1</div><div> ...</div><div><br></div><div> If such a feature were available, one could write a nice type synonym "Expr" and use it like so,</div>
<div><br></div><div>type Expr a = ExprTyp _ a</div><div><br></div><div>my_code_block = do</div><div> x :: Expr Integer <- instruction1</div><div><br></div><div> Suggestions for workarounds are appreciated. I created an `asExprTypeOf`, similar to Prelude's `asExprTyp`, but I don't like the syntax as much.</div>
<div><br></div><div> Some previous discussion</div><div>* <a href="http://www.haskell.org/pipermail/haskell/2002-April/009409.html">http://www.haskell.org/pipermail/haskell/2002-April/009409.html</a></div><div>* (a reply) <a href="http://www.haskell.org/pipermail/haskell/2002-April/009413.html">http://www.haskell.org/pipermail/haskell/2002-April/009413.html</a></div>
<div>* <a href="http://hackage.haskell.org/trac/haskell-prime/wiki/PartialTypeAnnotations">http://hackage.haskell.org/trac/haskell-prime/wiki/PartialTypeAnnotations</a></div><div><br></div><div>cheers,<br clear="all">Nicholas — <a href="https://ntung.com" target="_blank">https://ntung.com</a> — 4432-nstung<br>
</div>