Re: [racket] [typed racket] typing monads

2011-10-20 Thread Eric Tanter
On Oct 20, 2011, at 5:09 PM, Sam Tobin-Hochstadt wrote: > > Unfortunately, Typed Racket doesn't support higher-kinded type > parameters, which is what you would need here. That's what we thought/feared. > If you have an example of how you want to use this where the solution > I gave earlier does

Re: [racket] [typed racket] typing monads

2011-10-20 Thread Sam Tobin-Hochstadt
On Thu, Oct 20, 2011 at 2:52 PM, Eric Tanter 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, stat

Re: [racket] [typed racket] typing monads

2011-10-20 Thread Ryan Culpepper
On 10/20/2011 01:27 PM, Jay McCarthy wrote: On Thu, Oct 20, 2011 at 12:52 PM, Eric Tanter 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 sever

Re: [racket] [typed racket] typing monads

2011-10-20 Thread Jay McCarthy
On Thu, Oct 20, 2011 at 12:52 PM, Eric Tanter 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, sta

Re: [racket] [typed racket] typing monads

2011-10-20 Thread Eric Tanter
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 .

Re: [racket] [typed racket] typing monads

2011-10-20 Thread Sam Tobin-Hochstadt
On Thu, Oct 20, 2011 at 10:45 AM, Eric Tanter wrote: > Hi, > > Is there a way to type a monad? > > For example in OCaml: > > module type MonadRequirements = sig >    type ‘a t >    val bind : ‘a t -> (‘a -> ‘b t) -> ‘b t >    val return : ‘a -> ‘a t > end;; > > In Typed Racket we can use a polymor

[racket] [typed racket] typing monads

2011-10-20 Thread Eric Tanter
Hi, Is there a way to type a monad? For example in OCaml: module type MonadRequirements = sig type ‘a t val bind : ‘a t -> (‘a -> ‘b t) -> ‘b t val return : ‘a -> ‘a t end;; In Typed Racket we can use a polymorphic struct to have the parametrization by 'a and 'b, but is it possible