I am trying to use FAKE for automating my project builds. In the process, I wrote the following F# code -
open System
open System.IO
module FileUtils =
type BuildConfiguration = {Name:string; Directory:string}
let DebugBuildConfiguration = {Name = "Debug"; Directory = @"\bin\Debug"}
let ReleaseBuildConfiguration = {Name = "Release"; Directory = @"\bin\Release"}
let StagingBuildConfiguration = {Name = "Staging"; Directory = @"\bin\Staging"}
let codeDir = @"C:\source-control\s4sold\src"
let sourceDirs = [| "co"; "lo"; "mo"; "po"; "pr"; "pro"; "re"; "ro" |]
let GetAllBuildConfigurationDirs buildConfiguration =
let allSourceDirs = sourceDirs
|> Seq.map (fun i -> Path.Combine(codeDir, i))
|> Seq.map (fun d -> Directory.GetDirectories(d))
|> Array.concat
allSourceDirs |> printf "%A"
List.ofArray allSourceDirs
|> List.map (fun i -> Path.Combine(i, buildConfiguration.Directory))
// |> Seq.toArray
Now the problem I am facing is that when I print allSourceDirs, it correctly prints the directories under my /src folder. But when I run GetAllBuildConfigurationDirs, all I get is an array of "\bin\Debug", which means it doesn't take the output of allSourceDirs into consideration.
I am really at a loss to understand what's happening here. I am an F# newbie, but know some Clojure. Also how can I use Seq.map over a seq of seqs (so that I might avoid the Array.concat call)?
Seq.collect, which is an equivalent offlatMaporSelectMany. :) - Patryk Ćwiek