Does the inner sequence need to be a list? If it always has the same elements (OHLC) it would be better to use a tuple (or a custom type) since it makes explicit its fixed nature. I would probably do something like this:
module Stock =
let (!) s = DateTime.Parse(s)
let getOHLC() : unit -> seq<DateTime * float * float * float * float> =
seq [
!"18-Dec-12",27.25,27.63,27.14,27.56
!"17-Dec-12",26.79,27.22,26.68,27.10
!"14-Dec-12",27.11,27.13,26.70,26.81
//...
]
If you really need each element to be a list, you can pipe it through Seq.map seq
.
The seq
function is defined as:
let seq (x:seq<'T>) = x
so it only upcasts, not copy.