[racket] [typed racket] typing monads

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Thu Oct 20 16:09:57 EDT 2011

On Thu, Oct 20, 2011 at 2:52 PM, Eric Tanter <etanter at dcc.uchile.cl> wrote:
> Thanks Sam,
>
> Actually, that's not what we're after.
>
> In untyped Racket, we have a struct monad:
>
> (struct monad
>  (;; A -> M A
>   return
>   ;; A -> (A -> M B) -> M B
>   bind))
>
> Then we have several instantiations (exception, state, what-have-you):
> (define my-fancy-monad (monad (lambda ...) (lambda ...)))
>
> It is feasible to type the particular instantiations (the return/bind functions we need in each case), but we'd like to type the monad struct itself.
> The question is what to do about M?

Unfortunately, Typed Racket doesn't support higher-kinded type
parameters, which is what you would need here.

If you have an example of how you want to use this where the solution
I gave earlier doesn't work, I can probably give a better answer of
how to handle it.
-- 
sam th
samth at ccs.neu.edu



Posted on the users mailing list.