Q:

OCaml using parametrized module

In OCaml, I am dealing with a module and a functor.
I set up the signature and struct for the input module and the functor.
Then I made a new module using modules above.
It turned out that my new module does not contain functions in the input module.
Am I supposed to be able to use functions with my new module?
Functions in the functor works fine, by the way.
Also, How can I make sure if it is a valid module? 

A:

Let's take a real example:
module type MONAD = sig
  type 'a t
  val return : 'a -> 'a t
  val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
end

module MonadOps (M : MONAD) = struct
  open M (* values from M visible in scope *)
  let rec mapM f = function
    | [] -> return []
    | x::xs ->
        f x >>= fun y -> 
        mapM f xs >>= fun ys ->
        return (y :: ys)
end

module Option = struct
  type 'a t = 'a option
  let return x = Some x
  let (>>=) m f = match m with
    | None -> None
    | Some x -> f x
end

module OptionOps = MonadOps(Option)

let test = OptionOps.mapM
(* val test : ('a -> 'b Option.t) -> 'a list -> 'b list Option.t = <fun> *)
let test = OptionOps.return x
(* Error: Unbound value OptionOps.return *)

The functor MonadOps provides some generic features built on top of any monad, but it does not by itself contain the base monad features. It provides extra stuff without including the existing stuff.
You can change that by using the include item to include the content of an existing module inside the module value being defined:
module MonadOps (M : MONAD) = struct
  include M (* values from m *included* in the module *)
  let rec mapM f = function
    [...]
end

However, I don't necessarily advise to do that. You are introding some redundancy that is convenient in some situations (eg. if you want to open just one module and have everything in scope), but can also make for some problems in other situations, eg. if you want to combine two module-extending functor you have to wonder in which order to apply them, and you may run into strange module-system hackery. ML module systems are complex beasts inside, and I recommend to keep your uses simple to avoid run into corners.
Note that by not including M into the functor, you leave the functor's users the choice to do it whenever they want to: they have more options that if you decide to include it directly in the functor. The way I would use such a functor would be something like
(* file 'option.ml' *)
type 'a option = None | Some of 'a

module Monad = struct
  ...
end

module Ops = MonadOps(Monad)

include (Monad : MONAD with type 'a t := 'a option)
include Ops

A:

In a simpler setting, any value exported by the module M bound in functor F can be accessed by using the M. qualifier (like for any module):
(* out there M does not exist *)
module F (M : sig val v : int end) =
struct
    (* in there M is defined *)
    let m_v = M.v
end

or by using open M before any access to values of M.
module  F (M : sig val v : int end) =
struct
    open M
    let m_v = v
end

If you want to make the values of M available from the module generated by F, you must somehow export it, either:

directly by aliasing certain values of M in the new module, 
module F (...) = struct
    let v = M.v
end

by including the module in its entirety
module F (...) = struct
    include M
end

It is not necessary always possible or easy to use inclusion, since you might want to define types name colliding with other types in M.
by making the module a part of the new module
module F (....) = struct
    module M' = M
end

module G = F(struct let v = 5 end);;
print_int G.M.v;;

Include or not include? It depends on the client side of the functor, and the client side of the generated module. You might work on a programme which must only know about the generated module, or only know about the functor. If the module M content is necessary for operating the module G, which is delivered ready made, then you have to provide M somehow.

