Alan Mulligan
Alan Mulligan

Reputation: 1198

F# Create a sequence of a certain type

I am writing some unit tests at the moment and need to replicate a sequence. The sequence is of type (string * string * string). I have tried to recreate this sequence by

let aSequence = seq<aType>{ ("ABC","DEF","GHI"); ("JHL","MNO","PQR") }

What am I doing wrong?

Upvotes: 1

Views: 365

Answers (1)

Robert Jeppesen
Robert Jeppesen

Reputation: 7877

No need to specify the type for (string * string * string), F# can infer it. You need to use the yield keyword. Read more about seq here.

let aSequence = seq { yield "ABC","DEF","GHI"
                      yield "JHL","MNO","PQR" }

Upvotes: 2

Related Questions