Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: [Caml-list] function vs. parser
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Gerd Stolpmann <info@g...>
Subject: Re: [Caml-list] function vs. parser
On Thu, 13 Sep 2001, Krishnaswami, Neel wrote:
>Anyway, for some Caml-related content, is there a way to use qualified 
>paths and infix notation together?
>
>I mean, if I have:
>
>  module Foo = struct let (+++) x y = List.append x y end
>
>Right now I have to write 
> 
>  Foo.(+++) [1; 2] [3; 4]
>
>Is there any way I can write something like 
>
>  [1; 2] Foo.+++ [3; 4]
>
>without using open or rebinding the Foo module's function in the local
>namespace?

As far as I know, it is not possible.

As a workaround, I use sometimes a submodule only for operators:

module Foo = struct
  let foo x y = ...
  
   module Operators = struct
      let (+++) = foo
   end
end

So you can open only the Foo.Operators module, and have more control over the
namespace.

Gerd
-- 
----------------------------------------------------------------------------
Gerd Stolpmann      Telefon: +49 6151 997705 (privat)
Viktoriastr. 45             
64293 Darmstadt     EMail:   gerd@gerd-stolpmann.de
Germany                     
----------------------------------------------------------------------------
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr