Skip to content
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
26 changes: 11 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
name: (fast) CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]

branches: [main]
jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v21
- uses: cachix/cachix-action@v12
with:
name: guibou
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

# Builds
- name: Build current GHC
run: nix build .#pyf
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v21
- uses: cachix/cachix-action@v12
with:
name: guibou
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
# Builds
- name: Build current GHC
run: nix build
62 changes: 27 additions & 35 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,42 @@
name: Complete CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]

branches: [main]
jobs:
nix_matrix:
strategy:
matrix:
# 88 is not in nixpkgs anymore
# 910 does not build yet for unknown reason
# We are not using nix build .#pyf_all because of github disk limitations
ghc: [86, 90, 92, 94, 96, 98]
ghc: [90, 92, 94, 96, 98, 910, 912]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v21
- uses: cachix/cachix-action@v12
with:
name: guibou
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

# Builds cabal (nix)
- name: Build with GHC ${{ matrix.ghc }}
run: nix build .#pyf_${{ matrix.ghc }}

- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v21
- uses: cachix/cachix-action@v12
with:
name: guibou
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
# Builds cabal (nix)
- name: Build with GHC ${{ matrix.ghc }}
run: nix build .#pyf_${{ matrix.ghc }}
stack_build:
strategy:
matrix:
resolver: [ lts-14.27 # 8.6
, lts-16.31 # 8.8
, lts-17.1 # 8.10
, lts-19.1 # 9.0
, lts-20.26 # 9.2
, lts-21.17 # 9.4
, lts-22.22 # 9.6
, nightly-2024-05-15 # 9.8 nightly
]

resolver: [lts-14.27, # 8.6
lts-16.31, # 8.8
lts-17.1, # 8.10
lts-19.1, # 9.0
lts-20.26, # 9.2
lts-21.17, # 9.4
lts-22.22, # 9.6
lts-23.2, # 9.8
nightly-2025-01-03, # 9.10 nightly
]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup Stack
run: sudo apt-get install haskell-stack
- name: Stack resolver ${{ matrix.resolver }}
run: stack --resolver ${{ matrix.resolver }} test
- uses: actions/checkout@v2
- name: Setup Stack
run: sudo apt-get install haskell-stack
- name: Stack resolver ${{ matrix.resolver }}
run: stack --resolver ${{ matrix.resolver }} test
33 changes: 23 additions & 10 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Revision history for PyF

- Support for GHC 9.12
- No more "python" reference check in the test phase. I'm removing complexity,
and if it does not match the python implementation, we can just introduce a
new test case. Note that python checking can be reimplemented easilly by
parsing the AST.

## 0.11.3.0 -- 2024-05-15

- Support for GHC 9.10.
Expand Down Expand Up @@ -27,8 +33,8 @@

- Support for GHC 9.4. (Written with a pre-release of GHC 9.4, hopefully it won't change too much before the release).
- Error reporting now uses the native GHC API. In summary, it means that
haskell-language-server will point to the correct location of the error, not
the beginning of the quasi quotes.
haskell-language-server will point to the correct location of the error, not
the beginning of the quasi quotes.
- PyF will now correctly locate the error for variable not found in expression, even if the expression is complicated. The support for complex expression is limited, and PyF may return a false positive if you try to format a complex lambda / case expression. Please open a ticket if you need that.
- Add support for literal `[]` and `()` in haskell expression.
- Add support for overloaded labels, thank you Shimuuar.
Expand All @@ -48,21 +54,30 @@
## 0.10.0.1 -- 2021-10-30

- Due to the dependencies refactor, `PyF` no have no dependencies other than the one packaged with GHC. The direct result is that `PyF` build time is reduced to 6s versus 4 minutes and 20s before.

- Remove the dependency to `megaparsec` and replaces it by `parsec`. This should have minor impact on the error messages.

- *Huge Change*. The parsing of embeded expression does not depend anymore on `haskell-src-ext` and `haskell-src-meta` and instead depends on the built-in `ghc` lib.

- Added instances for `(Lazy)ByteString` to `PyFClassify` and `PyFToString`. `ByteString` can now be integrated into format string, and will be decoded as ascii.

- Relax the constraint for floating point formatting from `RealFrac` to `Real`. As a result, a few new type can be formatted as floating point number. One drawback is that some `Integral` are `Real` too and hence it is not an error anymore to format an integral as floating point, but you still need to explicitly select a floating point formatter.

- Added instance for `(Nominal)DiffTime` to `PyFClassify`, so you can now format them without conversion.

- Introducing of the new typeclass `PyfFormatIntegral` and `PyfFormatFractional` in order to customize the formatting for numbers. An instance is derived for respectively any `Integral` and `Real` types.

- Support for `Char` formatting, as string (showing the `Char` value) or as integral, showing the `ord`.

- `Data.Ratio`.

- Introducing `fmtTrim` module. It offers the same behavior as `fmt`, but trims common indentation. Se `PyF.trimIndent` for documentation.

- Introducing `raw` for convenience. It is a multiline string without any escaping, formatting neither leading whitespace handling.
- Introducing `str` and `strTrim`. They are similar to `fmt` and `fmtTrim` but without formatting. You can see them as multiline haskell string, with special character escaping, but without formatting. For convenience, the `strTrim` version also removes indentation.

- Introducing `str` and `strTrim`. They are similar to `fmt` and `fmtTrim` but without formatting. You can see them as multiline haskell string, with special character escaping, but without formatting. For convenience, the `strTrim` version also removes indentation.

- `fmtWithDelimiters` is gone and replaced by `mkFormatter` in `PyF` which is "more" generic.
- `fmtWithDelimiters` is gone and replaced by `mkFormatter` in `PyF` which is "more" generic.

## 0.9.0.3 -- 2021-02-06

Expand Down Expand Up @@ -115,7 +130,6 @@
- Template haskell splices are simpler. This leads to more efficient / small generated code and in the event of this code appears in a GHC error message, it is more readable.
- PyF now longer emit unnecessary default typing.


## 0.7.3.0 -- 2019-02-28

- Tests: fix non reproducible tests
Expand All @@ -127,7 +141,7 @@
## 0.7.1.0 -- 2019-02-11

- Fixed: PyF was wrongly ignoring everything located after a non-doubled closing delimiter.
- New Feature: line break can be escaped with \, thus allowing string to start on a new line ignoring the initial backspace
- New Feature: line break can be escaped with , thus allowing string to start on a new line ignoring the initial backspace

## 0.7.0.0 -- 2019-02-04

Expand Down Expand Up @@ -169,15 +183,14 @@
- Introduce `PyF.Formatters`, type safe generic number formatter solution
- Remove dependency to `scientific`


## 0.3.0.0 -- 2018-04-01

* Support for haskell subexpression
- Support for haskell subexpression

## 0.1.1.0 -- 2018-01-07

* Add support for the `sign` field.
- Add support for the `sign` field.

## 0.1.0.0 -- 2018-01-03

* First version. Released on an unsuspecting world.
- First version. Released on an unsuspecting world.
156 changes: 94 additions & 62 deletions PyF.cabal
Original file line number Diff line number Diff line change
@@ -1,75 +1,107 @@
cabal-version: 2.4
name: PyF
version: 0.11.3.0
synopsis: Quasiquotations for a python like interpolated string formatter
description: Quasiquotations for a python like interpolated string formatter.
license: BSD-3-Clause
license-file: LICENSE
author: Guillaume Bouchard
maintainer: guillaum.bouchard@gmail.com
category: Text
build-type: Simple
extra-source-files: ChangeLog.md Readme.md test/golden/*.golden test/golden96/*.golden

Flag python_test
Description: Enable extensive python testing
Manual: True
Default: False
cabal-version: 2.4
name: PyF
version: 0.11.3.0
synopsis:
Quasiquotations for a python like interpolated string formatter

description:
Quasiquotations for a python like interpolated string formatter.

license: BSD-3-Clause
license-file: LICENSE
author: Guillaume Bouchard
maintainer: guillaum.bouchard@gmail.com
category: Text
build-type: Simple
extra-source-files:
ChangeLog.md
Readme.md
test/golden/*.golden
test/golden96/*.golden

library
exposed-modules:
PyF
PyF.Class
PyF.Internal.PythonSyntax
PyF.Internal.Meta
PyF.Internal.QQ
PyF.Formatters
PyF.Internal.ParserEx
PyF.Internal.Parser

build-depends: base >= 4.12 && < 4.22
, bytestring >= 0.10.8 && < 0.13
, template-haskell >= 2.14.0 && < 2.24
, text >= 1.2.3 && < 2.2
, time >= 1.8.0 && < 1.14
, parsec >= 3.1.13 && < 3.2
, mtl >= 2.2.2 && < 2.4
, ghc >= 8.6.1
if impl(ghc < 9.2.1)
build-depends:
ghc-boot >= 8.6.1 && < 9.7
hs-source-dirs: src
ghc-options: -Wall -Wunused-packages -Wincomplete-uni-patterns
default-language: Haskell2010
PyF
PyF.Class
PyF.Formatters
PyF.Internal.Meta
PyF.Internal.Parser
PyF.Internal.ParserEx
PyF.Internal.PythonSyntax
PyF.Internal.QQ

build-depends:
, base >=4.12 && <4.22
, bytestring >=0.10.8 && <0.13
, ghc >=8.6.1
, mtl >=2.2.2 && <2.4
, parsec >=3.1.13 && <3.2
, template-haskell >=2.14.0 && <2.24
, text >=1.2.3 && <2.2
, time >=1.8.0 && <1.15

if impl(ghc <9.2.1)
build-depends: ghc-boot >=8.6.1 && <9.7

hs-source-dirs: src
ghc-options: -Wall -Wunused-packages -Wincomplete-uni-patterns
default-language: Haskell2010
default-extensions: QuasiQuotes

test-suite pyf-test
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Spec.hs
other-modules: SpecUtils SpecCustomDelimiters
build-depends: base, PyF, hspec, template-haskell, text, bytestring, time
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -Wunused-packages
default-language: Haskell2010
if flag(python_test)
cpp-options: -DPYTHON_TEST
build-depends: process
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Spec.hs
other-modules: SpecCustomDelimiters
build-depends:
, base
, bytestring
, hspec
, PyF
, template-haskell
, text
, time

ghc-options:
-Wall -threaded -rtsopts -with-rtsopts=-N -Wunused-packages

default-language: Haskell2010

test-suite pyf-overloaded
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: SpecOverloaded.hs
build-depends: base, PyF, hspec, text, bytestring
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -Wunused-packages
default-language: Haskell2010
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: SpecOverloaded.hs
build-depends:
, base
, bytestring
, hspec
, PyF
, text

ghc-options:
-Wall -threaded -rtsopts -with-rtsopts=-N -Wunused-packages

default-language: Haskell2010

test-suite pyf-failure
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: SpecFail.hs
build-depends: base, hspec, text, process, hspec, temporary, filepath, deepseq, HUnit, PyF
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -Wunused-packages
default-language: Haskell2010
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: SpecFail.hs
build-depends:
, base
, deepseq
, filepath
, hspec
, HUnit
, process
, PyF
, temporary
, text

ghc-options:
-Wall -threaded -rtsopts -with-rtsopts=-N -Wunused-packages

default-language: Haskell2010

source-repository head
type: git
Expand Down
Loading
Loading