I am trying to create a stack of tuples in OCaml using the following piece of code
let (k : (string*string) Stack.t) = Stack.create ;;
But when doing so i get an error while compiling telling
Error: This expression has type unit -> 'a Stack.t
but an expression was expected of type (string * string) Stack.t
Am pretty new to OCaml. Can someone point out where I am going wrong?
Stack.create
is a function which takes the value()
(of typeunit
) and give you back a stack.So you should do:
if you write
Stack.create
, you just speak about the function, not the result.