acowley / Frames

Data frames for tabular data.
Other
297 stars 41 forks source link

Create a `tableTypesText` #100

Open idontgetoutmuch opened 6 years ago

idontgetoutmuch commented 6 years ago

I have created this

tableTypesText :: String -> FilePath -> DecsQ
tableTypesText n fp = tableTypesText' (rowGen fp) { rowTypeName = n }

but if I declare

tableTypesText "StateLevel" "/Users/dom/Dropbox/Tidy/Economics/mrp/data/statelevel.csv"
tableTypesText "Marriage"   "/Users/dom/Dropbox/Tidy/Economics/mrp/data/marriageData.csv"

I get

app/Main.hs:74:1: error:
    Multiple declarations of ‘Col’
    Declared at: app/Main.hs:73:1
                 app/Main.hs:74:1
   |
74 | tableTypesText "Marriage"   "/Users/dom/Dropbox/Tidy/Economics/mrp/data/marriageData.csv"
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
idontgetoutmuch commented 6 years ago

Also if I give the same column name to both files

[2 of 2] Compiling Main             ( app/Main.hs, interpreted )

app/Main.hs:74:1: error:
    Multiple declarations of ‘Rownum’
    Declared at: app/Main.hs:73:1
                 app/Main.hs:74:1
   |
74 | tableTypesText "Marriage"   "/Users/dom/Dropbox/Tidy/Economics/mrp/data/marriageData.csv"
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
acowley commented 6 years ago

I've tried to address the second bullet point above with this commit. It copies the logic used in tableTypes' to avoid creating duplicate type definitions.

Can you verify that it fixes this issue for you?