Created
October 28, 2015 14:01
-
-
Save Kimserey/d3408ae225cad911eab6 to your computer and use it in GitHub Desktop.
Write to CSV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module UserTable = | |
open System.IO | |
type List = | |
static member Write (path:string) (data:'a list) = | |
use writer = new StreamWriter(path) | |
data |> List.iter writer.WriteLine | |
let makeRow (data: string) = | |
sprintf "id_%s_1,User %s 1,[email protected],TOKENHASH" | |
<| data.Replace('-', '_') | |
<| data | |
[ | |
"yahoo-fr" | |
"yahoo-us" | |
"gmail-fr" | |
"gmail-us" | |
] | |
|> List.sortBy id | |
|> List.map makeRow | |
|> List.Write path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment