Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: [Caml-list] really HO Functions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jean-Baptiste Rouquier <jrouquiethearchiveshouldhaveafewantispamtricks@e...>
Subject: Re: [Caml-list] really HO Functions
Radu Grigore wrote:

>For this message I'll classify functions on "levels" based on how many
>nested parenthesis are needed to represent their type. (...)
>
>My question is: are there functions of level >= 2 used in practice
>(e.g. (('a -> 'b -> 'a) -> 'a -> 'b list -> 'a) -> 'c)?

In my soon-to-be-released library to read and write configuration files, I have
one example of this. Basically, the function reading a file (actually a method)
has on optional argument that allows the user to override the default behaviour
in case there is an error.
The argument is itself a function that get all the available information as
arguments, including a value of type (out_channel -> unit) that pretty print
(with module Format) a part of the read AST to the given output channel.
So I have
    method read : ... -> ... ->
      ?on_type_error : (... -> ... -> (out_channel -> unit) -> ... -> unit) ->
      string -> unit

Out of curiosity, may I ask why you're looking for such functions ?
Regards,

-- 
Jean-Baptiste Rouquier

-------------------
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