Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

How to make module implement multiple signatures

$
0
0

This works:

module MyModule: MySignature = { ... }

But how can I make MyModule to implement MySignature1 and MySignature2?
I know that in practice there might be signature fields conflicting between the two etc, but as long as I control the whole codebase, I can design it so the signatures are actually compatible or non-conflicting.

The workaround is to not define signature at all → after all things like functors are able to check the signature of a module even without it being explictly defined on the module. The difference between what I’m looking for, and that workaround, is the error message. I want my module to conform to (for example) two signatures like Order and Hash for various purposes, and if I modify signature I want the check to fail next to the module - not usage place.


Viewing all articles
Browse latest Browse all 2592

Trending Articles