0

Using the following .csv file:

Desc,Status
"CT3","undone"

I have written the following program:

{-# LANGUAGE TemplateHaskell #-}    
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE QuasiQuotes #-}

module Main where

import Data.Text
import Frames

tableTypes "Todo" "todo.csv"

main = return ()

However, when I load the program into GHCI I get the following:

*Main> :i Todo
type Todo = Record '["Desc" :-> Text]

Why does Frames not find the status column from the csv file?

-Eric M.

user1023733
  • 805
  • 5
  • 14
  • 2
    Please post the actual code you are using. As it stands 1. Your indentation is broken 2. Your csv file isn't formatted correctly 3. There is no `main` function in module `Main` so it won't load and 4. Fixing all these I can not reproduce your issue, seeing instead `type Todo = Record '["Desc" :-> Text, "Status" :-> Text]`. – Thomas M. DuBuisson Jun 13 '18 at 17:20
  • Also it is usually wise to make sure you are using the newest version of the library in question so you aren't bitten by any known/fixed bug. – Thomas M. DuBuisson Jun 13 '18 at 17:21
  • Please could you be more specific about the csv file being incorrectly formatted?( I can open it as is in Libreoffice...) – user1023733 Jun 13 '18 at 21:44
  • 1
    It is now correctly formatted thanks to the edit. I still can not reproduce your issue and see the information in my above comment for `:info Todo`. – Thomas M. DuBuisson Jun 13 '18 at 23:47
  • Maybe LibreOffice is being less strict about the formatting of the file than the Frames library. You may have to look at the nonprinting characters in the file. If you're running OS X or Linux you can run `cat -e todo.csv`. I get `Desc,Status$` on the first line and `"CT3","undone"$` on the next line. Frames parses it fine. Additionally, as the first commenter specified, can you mention the version of Frames you're using? I'm using Frames-0.3.0.2 – Kartik Sabharwal Jun 14 '18 at 11:28

1 Answers1

0

I am working on a project with Frames right now, so I recreated your example. Below are my results with Frames 0.3.0.2:

Ok, one module loaded.
H> main
it :: ()
(0.00 secs, 329,800 bytes)
H> :i Todo 
type Todo = Record '["Desc" :-> Text, "Status" :-> Text]

If you put up a repo someplace, I can take another look.

tylerweir
  • 1,265
  • 11
  • 16
  • @tylerweir listen to GhostCat. They're trying to help you. It's the only way a regular user has to contact you if you're making a mistake. So please learn from this. –  Oct 17 '18 at 13:53
  • I decided what I thought was the appropriate label for a question was in Triage. I did not make a mistake, as it's an interpretation.  GhostCat disagreed with me and made it public. – tylerweir Oct 17 '18 at 14:28