Saturday 15 February 2014

polymorphism - How can I create a type with multiple parameters in OCaml? -


I am trying to create a type that has multiple type parameters, I know that creating a type with a parameter For:

  type 'a foo =' a * int  

But I need two parameters, so that I do parameterize the 'int' part How can I do this?

The way to do this is:

  type ('A' , B) foo = 'a *' b  

are not type parameter quarries, so you have to provide them as a parameter in the Tupal form. A good example of this is the Hashtubule module:

  type ('A,' b) T  

type of hash table type 'A type To 'b.


No comments:

Post a Comment