Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
instanciation of functor using command line
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Thomas Gazagnaire <thomas.gazagnaire@i...>
Subject: instanciation of functor using command line

I have a functor F parametrized by n modules types T1,T2,...,Tn :

module Make : functor (M1: S1) -> ... functor (Mn : Tn) -> [...]

and I have multiples modules Mij having the signature Ti.

Then, I would like to parse the command line in order to let the user 
choose the different modules used to implement the given signatures.

Is there any other solution that the (ugly) one of making a big "match 
argv.(1),...,argv.(n) with" to enumerate all possible n-uplet and build 
the corresponding functor ?

Ideally, I would like to do something like :

module M1 = match argv.(1) with
	| "toto" -> Toto
	| "foo" -> Foo


module Mn = match argv.(n) with
	| "bar" -> Bar
	| "toto" -> Toto

module F = Make(M1)(M2)...(Mn)

but it seems not possible to do that.

Thanks !