The trick is explicitly stating the return type. (I also explicitly defined the input type in this example as well.) fun charListToIntList(L: char list) : int list = if L = nil then nil else [ord(hd(L))] @ charListToIntList(tl(L)) ; - charListToIntList([#"A", #"l", #"a", #"n"]); val it = [65,108,97,110] : int list