Skip to content
This repository was archived by the owner on May 19, 2026. It is now read-only.

Are parameterized modules/functors available? #98

Description

@AeroNotix

Hi,

I'm trying to make use of parameterized modules / functors and maybe I'm missing something.

module type SomeSig = sig
  val some_function : unit -> unit
end

module type SomeFunctor =
  functor (M : SomeSig) ->
  sig
    val some_function : unit -> unit
  end

module SomeModule : SomeFunctor =
  functor (M : SomeSig) ->
  struct
    let some_function () =
      Io.format "In parameterized module\n" [];
      M.some_function ();
  end

module SomeImpl =
  struct
    let some_function () =
      Io.format "In module implementing SomeSig\n" []
  end

module PMod = SomeModule(SomeImpl)

let main () =
  PMod.some_function ()

When I compile this file with caramel compile *.ml the main function gets compiled into such and there are no compilation errors:

-spec main() -> ok.
main() -> pmod:some_function().

Yet there is no pmod.erl file created, which is how I sort of expected the parameterized modules to be implemented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions