Skip to content

Instantly share code, notes, and snippets.

@benkolera
Created December 17, 2011 07:39
Show Gist options
  • Save benkolera/1489588 to your computer and use it in GitHub Desktop.
Save benkolera/1489588 to your computer and use it in GitHub Desktop.
Perl has broken my brain. This wont work; dummy!
prettyPrintDBInfo :: DBInfo -> String
prettyPrintDBInfo (DBInfo dbName (DBOptions useBString _ ) tbls) = unlines [
"DBInfo { ",
" dbName = \"" ++ dbName ++ "\"",
" , opts = DBOpts { useBString = " ++ (show useBString) ++ " }",
" , tbls = [" ,
(map prettyPrintTableInfo tbls) ,
" ] ",
"}"
]
prettyPrintTableInfo (TInfo tName cols) = unlines [
" TInfo {" ,
" tname = \""++ tName ++ "\"",
" cols = [",
(map (( " " ++ ) . show) cols) ,
" ]",
" }"
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment