If you change the first line to
fun in_list (x : ''a, y : ''a list) =
then it will behave as you want. Here ''a
is an equality type variable that can stand for any type that supports the =
operator.
You could also just leave out the types altogether and the most general correct type will be inferred.