Hi im trying to write a simple function using the standard library
it should take the following argument
try = fn: 'a -> 'b list option
a_list = 'a list
and the defintion is the following:
fun all_answers try a_list =
let fun acc(SOME(a), SOME(b)) = SOME(b@a)
| acc(_,_) = NONE
in
List.foldl (fn(x,y) => acc(try(x), y)) SOME([]) a_list
end
and i get the following error:
hw3provided.sml:70.3-70.60 Error: operator and operand don't agree [tycon mismatch]
operator domain: 'Z list option
operand: 'Y -> 'Y option
in expression:
(List.foldl (fn (<pat>,<pat>) => acc <exp>)) SOME
C:\Program Files (x86)\SMLNJ\\bin\.run\run.x86-win32.exe: Fatal error -- Uncaught exception Error with 0
raised at ../compiler/TopLevel/interact/evalloop.sml:66.19-66.27
ive tried decomposing the function and the error seems to correspond to the use of SOME([]), if i use NONE instead it typechecks perfectly
I am at a total loss here
just incase its significant im using the sublime repl to run the script