# Instantiating template for some types

**URL:** <https://discourse.ats-lang.org/t/instantiating-template-for-some-types/864>\
**Category:** Documentation\
**Tags:** template\
**Created:** [August 31, 2016, 6:17pm UTC](https://discourse.ats-lang.org/t/instantiating-template-for-some-types/864 "2016-08-31T18:17:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![steinwaywhw](https://sea1.discourse-cdn.com/flex019/user_avatar/discourse.ats-lang.org/steinwaywhw/32/2_2.png) [@steinwaywhw](https://discourse.ats-lang.org/u/steinwaywhw)\
**Post date:** [August 31, 2016, 6:17pm UTC](https://discourse.ats-lang.org/t/instantiating-template-for-some-types/864/1 "2016-08-31T18:17:57Z")

</div>

To instantiate a template over not one but some types, follow these examples.

```ocaml
implement (n:int) gprint_val<string1 n> (str) = 
    gprint_val<string> (g0ofg1 str)

implement (a:t@ype, b:t@ype) gcompare_val_val<@(a,b)> (x, y) = 
    let val c = gcompare_val_val<a> (x.0, y.0)
    in 
        if c != 0 
        then c 
        else gcompare_val_val<b> (x.1, y.1)
    end

```
