module CSV (lines, line) where import Data.Text (Text) import qualified Data.Text as T import Prelude hiding (lines) lines :: [[Text]] -> Text lines = T.unlines . map line line :: [Text] -> Text line = T.intercalate "," . map value value :: Text -> Text value text = if (T.isInfixOf "," text) then T.concat [ "\"", text, "\"" ] else text