You don't appear to have the correct type, to start with.
The example has type string list -> string
, where your function seems to have type 'a list * 'a list -> 'a list
.
To concatenate two strings, you would use ^
, not ::
.
The former has type string * string -> string
, while the latter has type 'a * 'a list -> 'a list
. As strings are not lists in SML, trying to concatenate them with ::
will cause a
type error.
To actually do what you want, in the simplest way, try
fun myconcat L = foldr (op^) "" L