List Info

Thread: "ocaml_beginners"::[] Using (sub)modules - fileutils for example




"ocaml_beginners"::[] Using (sub)modules - fileutils for example
user name
2006-11-27 09:49:33

I want to use the functions provided by fileutils written by Sylvain LE
GALL but I cannot figure out how to use it. For example I want to use
the 'ls' function.

In fileUtil.mli I get:
module type FILE_UTILS =
sig
val ls : filename -> filename list
val filter : test_file -> filename list -> filename list
val test : test_file -> filename -> bool
val which : ?path:filename list -> filename -> filename
val mkdir : ?parent:bool -> ?mode:int -> filename -> unit
val touch : ?create:bool -> filename -> unit
val find :
?follow:action_link ->
test_file -> filename -> ('a -> filename -> 'a) -> 'a -> 'a
val rm : ?force:interactive -> ?recurse:bool -> filename list -> unit
val cp :
?follow:action_link ->
?force:interactive ->
?recurse:bool -> filename list -> filename -> unit
val mv : ?force:interactive -> filename -> filename -> unit
val readlink : filename -> filename
val pwd : unit -> filename
val cmp : ?skip1:int -> filename -> ?skip2:int -> filename -> int option
val du : filename list -> size * (filename * size) list
val stat : filename -> stat
end

In the toplevel:

# FileUtil.ls;;
Characters 0-11:
FileUtil.ls;;
^^^^^^^^^^^
Unbound value FileUtil.ls

# FileUtil.FILE_UTILS.ls ;;
Characters 0-22:
FileUtil.FILE_UTILS.ls ;;
^^^^^^^^^^^^^^^^^^^^^^
Unbound value FileUtil.FILE_UTILS.ls

How am I supposed to use those functions from sub-modules?

Regards
Johann
--
Johann Spies Telefoon: 021-808 4036
Informasietegnologie, Universiteit van Stellenbosch

";Thou, even thou, art LORD alone; thou hast made
heaven, the heaven of heavens, with all their host,
the earth, and all things that are therein, the seas,
and all that is therein, and thou preservest them all;
and the host of heaven worshippeth thee.";
Nehemiah 9:6

__._,_.___
.

__,_._,___
"ocaml_beginners"::[] Using (sub)modules - fileutils for example
user name
2006-11-27 12:17:13

On Mon, Nov 27, 2006 at 11:49:33AM +0200, Johann Spies wrote:
> In fileUtil.mli I get:
> module type FILE_UTILS =

It's confusing isn't it ... Here FileUtil.FILE_UTILS is a module
type, not an actual module. A module type is just a signature
(similar to an "interface" in Java) which defines the type of the
functions and values in the module, but doesn't actually contain any
code to implement those functions.

I had to go and look at Sylvain's code to see that this module type is
actually implemented by various concrete modules, including
FileUtil.StrUtil
(http://sylvain.le-gall.net/ocaml-fileutils/FileUtil.StrUtil.html), so
you would, it seems, need to use FileUtil.StrUtil.ls, or one of the
other concrete modules.

Rich.

--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Internet Marketing and AdWords courses - http://merjis.com/courses - NEW!
Merjis blog - http://blog.merjis.com - NEW!

__._,_.___
.

__,_._,___
"ocaml_beginners"::[] Using (sub)modules - fileutils for example
user name
2006-11-27 13:29:32

On Mon, Nov 27, 2006 at 12:17:13PM +0000, Richard Jones wrote:
> On Mon, Nov 27, 2006 at 11:49:33AM +0200, Johann Spies wrote:
> > In fileUtil.mli I get:
> > module type FILE_UTILS =
>
> It's confusing isn't it ... Here FileUtil.FILE_UTILS is a module
> type, not an actual module. A module type is just a signature
> (similar to an "interface" in Java) which defines the type of the
> functions and values in the module, but doesn't actually contain any
> code to implement those functions.
>
> I had to go and look at Sylvain's code to see that this module type is
> actually implemented by various concrete modules, including
> FileUtil.StrUtil
>; (http://sylvain.le-gall.net/ocaml-fileutils/FileUtil.StrUtil.html), so
> you would, it seems, need to use FileUtil.StrUtil.ls, or one of the
> other concrete modules.

Thanks.

Regards
Johann
--
Johann Spies Telefoon: 021-808 4036
Informasietegnologie, Universiteit van Stellenbosch

";Thou, even thou, art LORD alone; thou hast made
heaven, the heaven of heavens, with all their host,
the earth, and all things that are therein, the seas,
and all that is therein, and thou preservest them all;
and the host of heaven worshippeth thee.";
Nehemiah 9:6

__._,_.___
.

__,_._,___
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )