Advanced Functional Prog.


Extraction Transformation Language (ETL)

Data transformations can be easilly represented by dataflow models implemented in F#.

Sample data sources/seeds are provides by files modeled in .Net framework by the File class, from System.IO package, with 2 static methods ReadAllText and WriteAllText.

Now, File.ReadAllText(filename:string):string is similar to a function and is useable in all F# programs: in particular, it can be composed with the composition operator (|>).

open System.IO
File.ReadAllText("source.txt") |> fun data->File.WriteAllText("copy.txt",data)

Or equivalently:

let load filename = System.IO.ReadAllText(filename)
let save filename data = System.IO.WriteAllText(filename,data)

load "source.txt" |> save "copy.txt"