Missing column in inferred type
I have a CSV text file with two columns: quoted text, integer
"Beginner : read(ing) tutorial material/solved some coding exercises",11
"Beginning : wrote less than 2 libraries or applications/unpublished",30
"Intermediate : wrote and published on Hackage 3 or more libraries/applications",16
"Advanced intermediate : wrote multiple libraries/applications - co-maintain various packages",13
"Advanced : contribute regularly patches to GHC - among other things",0
"Expert : proposed or commented on one or more language extensions",0
(yes, it's from the DataHaskell survey from last month)
My program is as follows, as per the Frames tutorial :
{-# language TemplateHaskell, DataKinds, FlexibleContexts #-}
module Lib where
import Frames
import Frames.CSV
tableTypes' (rowGen "april-5-2018/data/q1"){
rowTypeName = "Q1Row"
, columnNames = [ "Label", "Count" ]
, tablePrefix = "Q1"}
But after noticing a typechecking problem (typeQ1Count not in scope), I dumped the generated TH with -ddump-splices, and in fact the types for the second column are not generated. How come? Is there a problem with the text in the first column? Simpler rows such as "abc", 123 work as intended.
src/Lib.hs:(26,1)-(29,23): Splicing declarations
tableTypes'
(rowGen "april-5-2018/data/q1")
{rowTypeName = "Q1Row", columnNames = ["Label", "Count"],
tablePrefix = "Q1"}
======>
type Q1Row =
Record ((ghc-prim-0.5.1.1:GHC.Types.:) ((:->) "Label" Text) '[])
q1RowParser :: ParserOptions
q1RowParser
= ((ParserOptions (Just ((map Data.Text.pack) ["Label", "Count"])))
(Data.Text.pack ","))
(RFC4180Quoting '"')
type Q1Label = (:->) "Label" Text
q1Label ::
forall f_a7sS rs_a7sT.
(Functor f_a7sS,
RElem Q1Label rs_a7sT (Data.Vinyl.TypeLevel.RIndex Q1Label rs_a7sT)) =>
(Text -> f_a7sS Text) -> Record rs_a7sT -> f_a7sS (Record rs_a7sT)
q1Label = rlens (Data.Proxy.Proxy :: Data.Proxy.Proxy Q1Label)
q1Label' ::
forall f_a7sU g_a7sV rs_a7sW.
(Functor f_a7sU,
Functor g_a7sV,
RElem Q1Label rs_a7sW (Data.Vinyl.TypeLevel.RIndex Q1Label rs_a7sW)) =>
(g_a7sV Q1Label -> f_a7sU (g_a7sV Q1Label))
-> Rec g_a7sV rs_a7sW -> f_a7sU (Rec g_a7sV rs_a7sW)
q1Label' = rlens' (Data.Proxy.Proxy :: Data.Proxy.Proxy Q1Label)
I went ahead and added this is as a test case, but can't reproduce the problem. It's likely that I didn't reproduce your combination of versions, so I've uploaded a new version of Frames (version 0.4.0) without too many breaking changes before I get around to releasing the new-new version that has more substantial new features. If you get a chance, let me know if the problem still arises for you as I'd like to figure out where it comes from.
Sorry for the delay in getting around to this.