I, i have this simple program in ocaml
type tree = Node of string * exp * tree * tree | Empty
and exp = Etree of tree | EInt of int | List of (string*exp);;
let rec evalNode.......
and rec eval (e:exp) =
(match e with
| EInt _ -> e
| Etree(tree) -> (match tree with
| Empty -> []
| Node(s,i,t1,t2) -> (evalNode (tree)) )
)
evalNode : tree -> (string * exp) list = fun
eval : exp -> exp = fun
but return this error but i don't undestand what does means, there aren't much information of ocaml in the web:
This expression has type (string * 'a) list, but is used with type exp.
Etree has a type Node inside, so is type tree, so i can call evalNode with this value because it want a tree type
evalNode return a list of (string*exp) but is a exp so eval can return this
List of (string*exp)
for(string*exp) list
– glennsl