vibin
vibin

Reputation: 15

Uncertain of how to read OCaml function type signatures

Could someone explain to me the following type? Specifically the return type.

string list -> (string * string * string) list 

Upvotes: 0

Views: 160

Answers (1)

Chris
Chris

Reputation: 36650

Expression Meaning
-> indicates a function type from one type to another.
string list is the type of a list of strings.
string * string * string is the type of a tuple of three strings.
(string * string * string) list is the type of a list of those tuples.

Therefore string list -> ( string * string * string) list is the type of a function which maps from a list of strings to a list of tuples of three strings.

Upvotes: 7

Related Questions