From 8cb40d1c54a19a561bbd7bcced4c7ed9f1bfb51a Mon Sep 17 00:00:00 2001 From: Michael Coady Date: Wed, 28 Jan 2026 12:42:57 +0000 Subject: [PATCH 1/2] fix broken `cabal build` in Windows --- dataframe.cabal | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dataframe.cabal b/dataframe.cabal index a47adea..4c23109 100644 --- a/dataframe.cabal +++ b/dataframe.cabal @@ -157,8 +157,9 @@ executable dataframe directory >= 1.3.0.0 && < 2, filepath >= 1.4 && < 2, process >= 1.6 && < 2, - time >= 1.12 && < 2, - unix >= 2 && < 3 + time >= 1.12 && < 2 + if !os(windows) + build-depends: unix >= 2 && < 3 hs-source-dirs: app default-language: Haskell2010 ghc-options: -rtsopts -threaded -with-rtsopts=-N From 838c46e5a08e6f1dcf0a1547f78597825ced6459 Mon Sep 17 00:00:00 2001 From: Michael Coady Date: Wed, 28 Jan 2026 15:27:56 +0000 Subject: [PATCH 2/2] spin out `decodeSeparated` from `readSeparated` --- src/DataFrame/IO/CSV.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/DataFrame/IO/CSV.hs b/src/DataFrame/IO/CSV.hs index 23cca80..c4bcbd5 100644 --- a/src/DataFrame/IO/CSV.hs +++ b/src/DataFrame/IO/CSV.hs @@ -237,10 +237,14 @@ ghci> D.readSeparated (D.defaultReadOptions { columnSeparator = ';' }) ".\/data\ @ -} readSeparated :: ReadOptions -> FilePath -> IO DataFrame -readSeparated !opts !path = do - let sep = columnSeparator opts +readSeparated opts !path = do let stripUtf8Bom bs = fromMaybe bs (BL.stripPrefix "\xEF\xBB\xBF" bs) csvData <- stripUtf8Bom <$> BL.readFile path + decodeSeparated opts csvData + +decodeSeparated :: ReadOptions -> BL.ByteString -> IO DataFrame +decodeSeparated !opts csvData = do + let sep = columnSeparator opts let decodeOpts = Csv.defaultDecodeOptions{Csv.decDelimiter = fromIntegral (ord sep)} let stream = CsvStream.decodeWith decodeOpts Csv.NoHeader csvData