-- compatibility conversion function
cTableToCMS :: CTable -> ColumnMemoryStore
cTableToCMS ct = 
    Prelude.foldl proc emptyCMS (Map.toList ct)
    where proc acc (k,v) = case v of
                                (CDouble c) -> acc {doubleCols = Map.insert k c (doubleCols acc), typeSchema = Map.insert k PDouble (typeSchema acc)}
                                (CInt c) -> acc { intCols = Map.insert k c (intCols acc), typeSchema = Map.insert k PInt (typeSchema acc)}
                                (CText c) -> acc {textCols = Map.insert k c (textCols acc), typeSchema = Map.insert k PText (typeSchema acc)}
cTableToCMS :: CTable -> ColumnMemoryStore
cTableToCMS ct = 
    Prelude.foldl proc emptyCMS (Map.toList ct)
    where proc acc (k,v) = case v of
                                (CDouble c) -> acc {doubleCols = Map.insert k c (doubleCols acc), typeSchema = Map.insert k PDouble (typeSchema acc)}
                                (CInt c) -> acc { intCols = Map.insert k c (intCols acc), typeSchema = Map.insert k PInt (typeSchema acc)}
                                (CText c) -> acc {textCols = Map.insert k c (textCols acc), typeSchema = Map.insert k PText (typeSchema acc)}
cTableToCMS ct = 
    Prelude.foldl proc emptyCMS (Map.toList ct)
    where proc acc (k,v) = case v of
                                (CDouble c) -> acc {doubleCols = Map.insert k c (doubleCols acc), typeSchema = Map.insert k PDouble (typeSchema acc)}
                                (CInt c) -> acc { intCols = Map.insert k c (intCols acc), typeSchema = Map.insert k PInt (typeSchema acc)}
                                (CText c) -> acc {textCols = Map.insert k c (textCols acc), typeSchema = Map.insert k PText (typeSchema acc)}