Skip to content

Instantly share code, notes, and snippets.

@Kimserey
Created October 28, 2015 14:01
Show Gist options
  • Save Kimserey/d3408ae225cad911eab6 to your computer and use it in GitHub Desktop.
Save Kimserey/d3408ae225cad911eab6 to your computer and use it in GitHub Desktop.
Write to CSV
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