Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7196317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:45:21+00:00 2026-05-28T20:45:21+00:00

I know that it is possible to define recursive modules, does anyone know how

  • 0

I know that it is possible to define recursive modules, does anyone know how to define recursive signatures? For instance, I would like to realize:

module type AAA = sig
  module Bbb : BBB
  type 'a t 
  val f : 'a Bbb.t -> 'a t
end

module type BBB = sig
  module Aaa : AAA
  type 'a t 
  val g : 'a Aaa.t -> 'a t
end

Could anyone help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T20:45:22+00:00Added an answer on May 28, 2026 at 8:45 pm

    You can’t, as far as I can tell. The closest solution is to limit the “recursive” bits to what is actually needed to express each signature separately:

    module type AA =
    sig
      module B : sig type t end
      type t
      val f : unit -> B.t
    end
    
    module type BB =
    sig
      module A : sig type t end
      type t
      val g : unit -> A.t
    end
    

    And then refine when you define the modules:

    module rec A : AA with module B = B =
    struct
      module B = B
      type t = int
      let f () = B.g ()
    end
    and B : BB with module A = A =
    struct
      module A = A
      type t = int
      let g () = A.f ()
    end
    

    FWIW, one might think that it should be possible to express recursive signatures (with much repetition) by using recursive modules:

    module rec AA :
    sig
      module type T = sig module B : BB.T end
    end =
    struct
      module type T = sig module B : BB.T end
    end
    and BB :
    sig
      module type T = sig module A : AA.T end
    end =
    struct
      module type T = sig module A : AA.T end
    end
    

    However, that does not work:

    Error: Unbound module type BB.T
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an enumerated type that I would like to define the > ,
Does anyone know if it possible to define the equivalent of a java custom
I would like to know if it's possible that inside the main() function from
I know that it is possible (in theory) to create a new type at
We all know that it's possible to define custom jQuery selectors that start with
Does anybody know that is possible to make the value of tag to dynamic
I know that it is possible to define custom tags in ASP.NET with User
I know that in C# it is possible to define optional parameters. My question
I know that it's possible to replace the browse button, which is generated in
I know that it is possible to check how much physical RAM is installed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.