Version française
Home     About     Download     Resources     Contact us    
Browse thread
[oliver: Re: [Caml-list] Strings as arrays or lists...]
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: james woodyatt <jhw@w...>
Subject: Re: [Caml-list] extensional polymorphism
On Monday, Mar 3, 2003, at 17:10 US/Pacific, brogoff@speakeasy.net 
wrote:
> On Mon, 3 Mar 2003, james woodyatt wrote:
>> On Monday, Mar 3, 2003, at 12:10 US/Pacific, brogoff@speakeasy.net  
>> wrote:
>>>
>>> That's why I said "Agitate for extensional polyorphism!". You really 
>>> want a way to overload similar notations.
>>
>> If "extensional polymorphism" is what I want in order to be able to 
>> define an operator ( >>= ) that performs the monad bind operation on 
>> arbitrary monads, then yeah-- I'm all for it.
>>
>> I recently discovered the power of monadic programming, but I am in 
>> no hurry to switch to Haskell in order to get a nice clean syntax for 
>> it.
>
> You can do a fair bit of monadic programming in OCaml now, using the 
> module
> system. If you are interested, I'll show you, but you'll learn more by 
> just
> translating Wadler's early papers into OCaml. If you want to do 
> complicated
> monadics with several different monad types intertwined in the same 
> section of
> code, that may be tricky.

I want to do the tricky stuff.  I've moved beyond the toys, and I'm 
beginning to discover all the interesting ways you can combine monads 
of different types.  So far, I've been able to get away with limiting 
the scope of my monad types, but I'm wondering about what I can do when 
I don't have to worry about those limits.

I tend to collect multiple monad types, each with a different number of 
type parameters to them.

> Also, OCaml is an imperative language, so you have lots of monads 
> built in :-).

Yeah, and I prefer them when I can use them.  It's just that I've 
encountered a problem where I really want to avoid using the "built-in 
monad" types in fairly specific *parts* of my program.  And I don't 
want to be constrained by the requirement of Haskell to maintain 
referential transparency *everywhere* in my program.

> One of the problems I have with Haskell is that while there are a few 
> examples
> where it just suits the problem so well that the solution is magically
> concise and beautiful, I find that there are more places where the 
> emphasis on
> purity transforms trivial programming problems into a PhD level 
> research
> problems.
>
>> If "extensional polymorphism" will get me a cleaner syntax for monadic
>> programming without forcing me to give up all the things that make
>> Ocaml the best language in the universe for imperative programming,
>> then sign me up right here right now.
>>
>> How would extensional polymorphism get me what I want?
>
> It may ameliorate the problem I cited above in which you're juggling 
> many monads
> in the same section of code and you don't want to use (module) 
> qualified types
> to distinguish your bindMs and returnMs or whatever you want to call 
> your
> operations.

I just read the G'CAML readme and the Jun Furuse thesis on its home 
page.  It looks like it would basically work for what I want.   Sign me 
up for wanting extensional polymorphism in the Ocaml core language.


-- 
j h woodyatt <jhw@wetware.com>

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners