# Module Std_internal.Typerep

    module Typerep: sig .. end

runtime type representations

    type '_ t =

`|` | `Int : `int t``
`|` | `Int32 : `int32 t``
`|` | `Int64 : `int64 t``
`|` | `Nativeint : `nativeint t``
`|` | `Char : `char t``
`|` | `Float : `float t``
`|` | `String : `string t``
`|` | `Bool : `bool t``
`|` | `Unit : `unit t``
`|` | `Option : `'a t` -> `'a option t``
`|` | `List : `'a0 t` -> `'a0 list t``
`|` | `Array : `'a1 t` -> `'a1 array t``
`|` | `Lazy : `'a2 t` -> `'a2 Lazy.t t``
`|` | `Ref : `'a3 t` -> `'a3 Pervasives.ref t``
`|` | `Function : `('dom t * 'rng t)` -> `('dom -> 'rng) t``
`|` | `Tuple : `'a4 Tuple.t` -> `'a4 t``
`|` | `Record : `'a5 Record.t` -> `'a5 t``
`|` | `Variant : `'a6 Variant.t` -> `'a6 t`` | `(*` | The `Named` constructor both allows for custom implementations of generics based on name and provides a way to represent recursive types, the lazy part dealing with cycles | `*)`
`|` | `Named : `('a7 Named.t * 'a7 t Lazy.t option)` -> `'a7 t``

    type packed =

`|` | `T : `'a t` -> `packed``

    module Named: sig .. end

    module Tuple: sig .. end

    include Variant_and_record_intf.S

    val same : 'a t -> 'b t -> bool

`same t t'` will return a proof a equality if `t` and `t'` are the same type. One can think of two types being the `same` as two types whose values could be for example put in a list together. It is worth noting that this function *does not* operate compatiblity diffs between two different types with the same structure. Example:

            module M1 = struct
              type t = {
                a : int;
                b : float;
              } with typerep
            end
            module M2 = struct
              type t = {
                a : int;
                b : float;
              } with typerep
            end
            TEST = not (same M1.typerep_of_t M2.typerep_of_t)

            type a = int with typerep
            type b = int with typerep
            TEST = same typerep_of_a typerep_of_b

This is meant to recover type equality hidden by existential constructors. For a deeper introspection of the structure, `see Type_struct`.

Basically this function does structural equality for everything except variant types, record types, and named types with no lazy definition exposed. This last case is about types that are defined `with typerep(abstract)`

    val same_witness : 'a t ->
           'b t -> ('a, 'b) Type_equal.t option

    val same_witness_exn : 'a t ->
           'b t -> ('a, 'b) Type_equal.t

    val typename_of_t : 'a t -> 'a Typename.t

    val head : 'a t -> 'a t

`head ty` is used to traverse the `Named` constructor. It might be used when one care to pattern match directly on the representation in a low level way rather than going through a full generic. `head t` is `t` if `t` is not of the form `Named _`