Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebuild the nix flake; drop htoml dependency #173

Merged
merged 9 commits into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ jobs:
os: [ubuntu-latest]
cabal: ["3.6"]
ghc:
- "8.8.4"
- "8.10.7"
- "9.0.1"
- "9.2.1"
- "9.0.2"
- "9.2.8"
- "9.4.6"

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -59,9 +58,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
# stack: ["2.3.1"]
stack: ["latest"]
ghc: ["8.10.7"]
ghc: ["9.4.7"]

steps:
- uses: actions/checkout@v2
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 0.7.4
Replace the `htoml` package used in a test with `tomland`.

# 0.7.2

- Add `writeCSVopts` that accepts options to specify the CSV delimiter.
Expand Down
33 changes: 22 additions & 11 deletions Frames.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Frames
version: 0.7.3
version: 0.7.4
synopsis: Data frames For working with tabular data files
description: User-friendly, type safe, runtime efficient tooling for
working with tabular data deserialized from
Expand Down Expand Up @@ -30,7 +30,7 @@ extra-source-files: benchmarks/*.hs benchmarks/*.py
data/left1.csv data/right1.csv data/left_summary.csv
data/FL2.csv
cabal-version: >=1.10
tested-with: GHC == 8.6.5 || == 8.8.4 || == 8.10.7 || == 9.0.1 || == 9.2.1
tested-with: GHC == 8.6.5 || == 8.8.4 || == 8.10.7 || == 9.0.1 || == 9.2.1 || == 9.4.6

source-repository head
type: git
Expand Down Expand Up @@ -64,13 +64,13 @@ library
TypeOperators, ConstraintKinds, StandaloneDeriving,
UndecidableInstances, ScopedTypeVariables,
OverloadedStrings, TypeApplications
build-depends: base >=4.10 && <4.17,
ghc-prim >=0.3 && <0.9,
primitive >= 0.6 && < 0.8,
build-depends: base >=4.10 && <4.20,
ghc-prim >=0.3 && <0.10,
primitive >= 0.6 && < 0.9,
text >= 1.1.1.0,
template-haskell,
transformers,
vector,
vector < 0.14,
readable >= 0.3.1,
pipes >= 4.1 && < 5,
pipes-bytestring >= 2.1.6 && < 2.2,
Expand Down Expand Up @@ -150,7 +150,7 @@ executable demo
pipes
hs-source-dirs: demo/framestack/app
default-language: Haskell2010
ghc-options: -O2
ghc-options: -O2 -fsimpl-tick-factor=200
-- ghc-options: -O2 -fllvm

executable tutorial
Expand All @@ -176,7 +176,7 @@ executable benchdemo
hs-source-dirs: benchmarks
default-language: Haskell2010
-- ghc-options: -O2
ghc-options: -O2 -fllvm
ghc-options: -O2 -fllvm -fsimpl-tick-factor=200

-- A demonstration of dealing with missing data. Provided for source
-- code and experimentation rather than a useful executable.
Expand Down Expand Up @@ -227,6 +227,17 @@ executable modcsv
hs-source-dirs: demo
default-language: Haskell2010

executable timezones
if !flag(demos)
buildable: False
main-is: Main.hs
other-modules: TimeIn Columns
if flag(demos)
build-depends: base, Frames, tz, text, time, readable,
pipes, pipes-safe, template-haskell
hs-source-dirs: demo/TimeZones/src
default-language: Haskell2010

test-suite spec
type: exitcode-stdio-1.0
hs-source-dirs: test
Expand All @@ -235,9 +246,9 @@ test-suite spec
UncurryFold UncurryFoldNoHeader UncurryFoldPartialData
Categorical Chunks Issue145
build-depends: base, text, hspec, Frames, template-haskell,
temporary, directory, htoml, regex-applicative, pretty,
unordered-containers, pipes, HUnit, vinyl,
foldl >= 1.3 && < 1.5,
temporary, directory, tomland, regex-applicative, pretty,
unordered-containers, pipes, HUnit, vinyl,
foldl >= 1.3 && < 1.5, validation-selective,
attoparsec, lens, bytestring
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall
default-language: Haskell2010
Expand Down
6 changes: 0 additions & 6 deletions cabal.project

This file was deleted.

39 changes: 0 additions & 39 deletions default.nix

This file was deleted.

2 changes: 2 additions & 0 deletions demo/TimeZones/src/Columns.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
-- to parse data captured as 'Data.Time.LocalTime.LocalTime' values
-- into the \"America/Chicago\" time zone.
module Columns (MyColumns, TimeIn(..), Chicago(..)) where
import Data.Proxy (Proxy(..))
import Frames (CommonColumns)
import Frames.ColumnTypeable (Parseable(..))
import Frames.CSV (defaultSep, produceTokens)
import TimeIn

-- | Define a 'Parseable' instance for @TimeIn "America/Chicago"@
Expand Down
15 changes: 11 additions & 4 deletions demo/TimeZones/src/Main.hs
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
-- | Parse data including dates times in some implicit local time zone
-- into an absolute time using a supplied time zone.
module Main where
import Data.Proxy (Proxy(Proxy))
import Frames
import Frames.CSV
import Frames.TH (RowGen(columnUniverse), colQ, rowGen)
import Columns
import Pipes (Producer, (>->), runEffect)
import qualified Pipes.Prelude as P
import Pipes.Safe
import Frames (ColumnUniverse)
import Columns (MyColumns)

tableTypes' rowGen { columnUniverse = $(colQ ''MyColumns) } "users.csv"
-- tableTypes' rowGen { columnUniverse = $(colQ ''MyColumns) } "/Users/acowley/Projects/Frames/demo/TimeZones/users.csv"
tableTypes' ((rowGen "demo/TimeZones/users.csv") { columnUniverse = Proxy @MyColumns })

loadUsers :: Producer Row IO ()
loadUsers = readTable "users.csv"
loadUsers :: Producer Row (SafeT IO) ()
loadUsers = readTable "demo/TimeZones/users.csv"

main :: IO ()
main = runEffect $ loadUsers >-> P.print
main = runSafeEffect $ loadUsers >-> P.print
8 changes: 6 additions & 2 deletions demo/TimeZones/src/TimeIn.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE RankNTypes #-}
-- | Define the 'TimeIn' type that lets us specify in the type how a
-- 'LocalTime' should be converted to a 'UTCTime'.
module TimeIn where
import Control.Monad (MonadPlus, msum)
import Control.Monad (MonadPlus (mzero), msum)
import qualified Data.Text as T
import Data.Time.Clock
import Data.Time.Format
Expand All @@ -20,11 +21,14 @@ import Language.Haskell.TH
-- whence it came.
newtype TimeIn (zone :: Symbol) = TimeIn UTCTime deriving Show

failZero :: MonadPlus m => Maybe r -> m r
failZero = maybe mzero pure

-- | Try to parse a 'LocalTime' value using common formats.
parseLocalTime :: MonadPlus m => T.Text -> m LocalTime
parseLocalTime t = msum (map (($ T.unpack t) . mkParser) formats)
where formats = ["%F %T", "%F"]
mkParser = parseTimeM True defaultTimeLocale
mkParser = (failZero .) . parseTimeM True defaultTimeLocale

-- | @zonedTime "America/Chicago"@ will create a 'Parseable' instance
-- for the type @TimeIn "America/Chicago"@. You can then use this type
Expand Down
Loading
Loading