# Getting resulting sig and struct of a complex modular program

**URL:** <https://discuss.ocaml.org/t/getting-resulting-sig-and-struct-of-a-complex-modular-program/6762>\
**Category:** Learning\
**Tags:** module\
**Created:** [November 13, 2020, 6:46pm UTC](https://discuss.ocaml.org/t/getting-resulting-sig-and-struct-of-a-complex-modular-program/6762 "2020-11-13T18:46:35Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Luc\_ML](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/luc_ml/32/1671_2.png) [@Luc\_ML](https://discuss.ocaml.org/u/Luc_ML)\
**Post date:** [November 13, 2020, 6:46pm UTC](https://discuss.ocaml.org/t/getting-resulting-sig-and-struct-of-a-complex-modular-program/6762/1 "2020-11-13T18:46:35Z")

</div>

The OCaml module system lets create a very modular program with quite unlimited complexly nested sig and struct, while avoiding redundancy.  
But the resulting documentation reflects exactly that, which makes it hard to read, resulting in jumping from one sig (or struct) to another. It may give headache and especially provoke mistakes when writing an expression with illegal type.

What is the straightest manner to get the **resulting** signature and structure of an OCaml program:

- in its generated documentation
- from the toplevel (it seems roughly to work with `#show_module module-path` but it sometimes has weird behavior/result)

The error messages are also more complex, revealing the modular structure. It can even be harder to understand when polymorphic variants are used!  
Is there a way to limit that burden?  
One **simplistic** idea would be to program in a modular way, then to “flatten” the whole program in order to let him expose the resulting sig/struct.  
Is that idea sensible, and how to simply do that?

Thanks.

---

_[View the full topic](https://discuss.ocaml.org/t/getting-resulting-sig-and-struct-of-a-complex-modular-program/6762)._
