Skip to content

Commit

Permalink
switch to harpie (#41)
Browse files Browse the repository at this point in the history
* switch to harpie

* polish
  • Loading branch information
tonyday567 authored Oct 13, 2024
1 parent bed83dd commit 69ec40a
Show file tree
Hide file tree
Showing 8 changed files with 166 additions and 210 deletions.
42 changes: 22 additions & 20 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
name: build
on: [push]
name: haskell-ci

# INFO: The following configuration block ensures that only one build runs per branch,
# which may be desirable for projects with a costly build process.
# Remove this block from the CI workflow to let each CI job run to completion.
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

jobs:
hlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: haskell-actions/hlint-setup@v2
- uses: haskell-actions/hlint-run@v2
with:
Expand All @@ -14,8 +22,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/run-ormolu@v15
cabal:
- uses: haskell-actions/run-ormolu@v16
build:
name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -39,38 +47,32 @@ jobs:
with:
ghc-version: ${{ matrix.ghc-version }}

- name: Installed minor versions of GHC and Cabal
shell: bash
run: |
GHC_VERSION=$(ghc --numeric-version)
CABAL_VERSION=$(cabal --numeric-version)
echo "GHC_VERSION=${GHC_VERSION}" >> "${GITHUB_ENV}"
echo "CABAL_VERSION=${CABAL_VERSION}" >> "${GITHUB_ENV}"
- name: Configure the build
run: |
cabal configure --enable-tests --enable-benchmarks --disable-documentation
cabal build --dry-run
# The last step generates dist-newstyle/cache/plan.json for the cache key.

- name: Restore cached dependencies
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
id: cache
env:
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ runner.os }}-ghc-${{ env.GHC_VERSION }}-cabal-${{ env.CABAL_VERSION }}-plan-${{ hashFiles('**/plan.json') }}
restore-keys: |
${{ runner.os }}-ghc-${{ env.GHC_VERSION }}-cabal-${{ env.CABAL_VERSION }}-
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ env.key }}-

- name: Install dependencies
# If we had an exact cache hit, the dependencies will be up to date.
if: steps.cache.outputs.cache-hit != 'true'
run: cabal build all --only-dependencies

# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail.
- name: Save cached dependencies
uses: actions/cache/save@v3
# Caches are immutable, trying to save with the same key would error.
if: ${{ !steps.cache.outputs.cache-hit
|| steps.cache.outputs.cache-primary-key != steps.cache.outputs.cache-matched-key }}
uses: actions/cache/save@v4
# If we had an exact cache hit, trying to save the cache would error because of key clash.
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ steps.cache.outputs.cache-primary-key }}
Expand Down
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
0.7
===

- switch to harpie

0.6.1
===

Expand Down
9 changes: 0 additions & 9 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
packages:
chart-svg.cabal

allow-newer:
string-interpolate:template-haskell,
markup-parse:containers

source-repository-package
type: git
branch: master
location: https://github.com/conal/vector-space.git

write-ghc-environment-files: always

tests: True
18 changes: 7 additions & 11 deletions chart-svg.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: chart-svg
version: 0.6.1.0
version: 0.7.0.0
license: BSD-3-Clause
license-file: LICENSE
copyright: Tony Day (c) 2017
Expand Down Expand Up @@ -37,7 +37,7 @@ tested-with:
extra-doc-files:
ChangeLog.md
other/*.svg
readme.org
readme.md

source-repository head
type: git
Expand All @@ -62,19 +62,16 @@ library
hs-source-dirs: src
build-depends:
, Color >=0.3.2 && <0.4
, adjunctions >=4.0 && <5
, attoparsec >=0.13.2 && <0.15
, base >=4.14 && <5
, bytestring >=0.11.3 && <0.13
, containers >=0.6 && <0.8
, cubicbezier >=0.6 && <0.7
, flatparse >=0.5 && <0.6
, foldl >=1.4 && <1.5
, formatn >=0.3 && <0.4
, harpie >=0.1 && <0.2
, markup-parse >=0.1 && <0.2
, mtl >=2.2.2 && <2.4
, numhask >=0.11 && <0.13
, numhask-array >=0.10 && <0.12
, numhask-space >=0.10 && <0.12
, optics-core >=0.4 && <0.5
, random >=1.2 && <1.3
Expand All @@ -98,11 +95,10 @@ library

test-suite doctests
import: ghc2021-stanza
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: doctests.hs
ghc-options: -threaded
hs-source-dirs: test
build-depends:
, base
, chart-svg
, base >=4.14 && <5
, doctest-parallel >=0.3 && <0.4
ghc-options: -threaded
type: exitcode-stdio-1.0
File renamed without changes.
45 changes: 45 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

# Table of Contents

1. [Usage](#org829f981)
2. [Examples](#orge2856e9)

[![img](https://img.shields.io/hackage/v/chart-svg.svg)](https://hackage.haskell.org/package/chart-svg) [![img](https://github.com/tonyday567/chart-svg/workflows/haskell-ci/badge.svg)](https://github.com/tonyday567/chart-svg/actions?query=workflow%3Ahaskell-ci)

![img](other/banner.svg)

A charting library targetting SVG.


<a id="org829f981"></a>

# Usage

:r
:set prompt "> "
:set -XOverloadedLabels
:set -XOverloadedStrings
import Chart
import Optics.Core
lines = [[Point 0.0 1.0, Point 1.0 1.0, Point 2.0 5.0],[Point 0.0 0.0, Point 2.8 3.0],[Point 0.5 4.0, Point 0.5 0]]
styles = (\c -> defaultLineStyle & #color .~ palette c & #size .~ 0.015) <$> [0..2]
cs = zipWith (\s x -> LineChart s [x]) styles lines
lineExample = mempty & #chartTree .~ named "line" cs & #hudOptions .~ defaultHudOptions :: ChartOptions
writeChartOptions "other/usage.svg" lineExample

![img](other/usage.svg)

See the haddock documentation for a detailed overview.


<a id="orge2856e9"></a>

# Examples

To redraw all the examples in Chart.Examples

import Chart.Examples
writeAllExamples

ok

Loading

0 comments on commit 69ec40a

Please sign in to comment.