Problems with type arity

So I’m trying to write a function which takes as an argument any module that implements certain functions. The real code is more complex, but this is a minimal example that illustrates the problem:

module type Len_intf = sig
  type t
  val length : t -> int
end

let show (type a)
  (module L : Len_intf with type t = a)
  h =
  printf "len: %d\n" @@ L.length h

let test (type a) h =
  show (module Hashtbl : Len_intf with type t = a) h

Attempting to compile this results in:

Error: Signature mismatch:
   ...
   Type declarations do not match:
     type ('a, 'b) t = ('a, 'b) Poly.t
   is not included in
     type t
   They have different arities.
   File "test.ml", line 2, characters 2-8:
     Expected declaration
   File "src/hashtbl_intf.ml", line 552, characters 2-17:
     Actual declaration

Anyone know how to solve this? Furthermore, I want this code to work with both Base.Hashtbl and Base.Map, and those have different arities. Is this possible at all?

The simplest solution is to define a module type for higher arities (since they are the more constrained cases), and then define compatibility modules for lower arities types

module type Len = sig
  type 'a t
  val length: 'a t -> int
end
module M = struct
  type t = int
  let length _ = 1
end
module M_adapted: Len = struct
  include M
  type 'a t = M.t
end