diff --git a/Makefile b/Makefile index faeb584..03df3a1 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +# For internal testing only + dev: stack test :spec --file-watch --fast @@ -25,6 +27,8 @@ tspeed: tst: /usr/bin/time -l stack test :spec +jtst: + stack test :spec --fast rspeed: stack bench :sbench @@ -34,9 +38,16 @@ bench: stack bench :sbench --file-watch jstest: - stack test --fast --file-watch --stack-yaml=stack-ghcjs.yaml + stack clean;stack test --fast --file-watch --stack-yaml=stack-ghcjs.yaml --ghc-options "-UENUM_LARGE -UTEST_DECBITS" + +jsbench: + stack bench :sbench --stack-yaml=stack-ghcjs.yaml + +jsprof: + node --prof /Users/titto/workspace/flat/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0_ghcjs/build/spec/spec + node --prof-process isolate-0x102801c00-v8.log > processed.txt -docs: +docs: stack haddock --no-haddock-deps --open eta: diff --git a/README.md b/README.md index c52542e..ef2cb3b 100644 --- a/README.md +++ b/README.md @@ -131,28 +131,19 @@ Should also work with (not recently tested): * [ghc](https://www.haskell.org/ghc/) 7.10.3/LLVM 3.5.2 (Arm7) #### [GHCJS](https://github.com/ghcjs/ghcjs) - -Tested with: - -``` -compiler: ghcjs-0.2.1.9007019_ghc-8.0.1 -compiler-check: match-exact -setup-info: - ghcjs: - source: - ghcjs-0.2.1.9007019_ghc-8.0.1: - url: http://ghcjs.tolysz.org/ghc-8.0-2017-02-05-lts-7.19-9007019.tar.gz - sha1: d2cfc25f9cda32a25a87d9af68891b2186ee52f9 -``` Passes all tests in the `flat` testsuite, except for those relative to short bytestrings (Data.ByteString.Short) that are unsupported by `ghcjs`. -If you use a different version of `ghcjs`, you are advised to run the full test suite by setting your compiler in `stack-ghcjs.yaml` and then running: +Check [stack-ghcjs.yaml](https://github.com/Quid2/flat/blob/master/stack-ghcjs.yaml) to see with what versions of `ghcjs` it has been tested. + +If you use a different version of `ghcjs`, you might want to run the test suite by setting your compiler in [stack-ghcjs.yaml](https://github.com/Quid2/flat/blob/master/stack-ghcjs.yaml) and then running: `stack test --stack-yaml=stack-ghcjs.yaml` NOTE: Versions prior to 0.33 encode `Double` values incorrectly when they are not aligned with a byte boundary. +NOTE: A [native TypeScript/JavaScript version](https://github.com/Quid2/ts) of `flat` is under development. + #### [ETA](https://eta-lang.org/) It builds (with etlas 1.5.0.0 and eta eta-0.8.6b2 under macOS Sierra) and seems to be working, though the full test suite could not be run due to Eta's issues compiling some of the test suite dependencies. diff --git a/flat.cabal b/flat.cabal index 03dc0dc..e48f6db 100644 --- a/flat.cabal +++ b/flat.cabal @@ -2,13 +2,13 @@ name: flat version: 0.3.3 synopsis: Principled and efficient bit-oriented binary serialization. description: Principled and efficient bit-oriented binary serialization, check the . -homepage: http://github.com/Quid2/flat +homepage: http://quid2.org category: Data,Parsing,Serialization license: BSD3 license-file: LICENSE author: Pasqualino `Titto` Assini maintainer: tittoassini@gmail.com -copyright: Copyright: (c) 2016 Pasqualino `Titto` Assini +copyright: Copyright: (c) 2016-2018 Pasqualino `Titto` Assini cabal-version: >=1.10 build-type: Simple -- The library (but not its tests) compiles with ETA >= 0.7.2 (see https://eta-lang.org/) @@ -98,7 +98,11 @@ test-suite spec default-language: Haskell2010 hs-source-dirs: test - cpp-options: -DLIST_BIT -DENUM_LARGE -DTEST_DECBITS + cpp-options: -DLIST_BIT + -- Add large data types test + -- cpp-options: -DENUM_LARGE + -- Add low level decoding test + -- cpp-options: -DTEST_DECBITS other-modules: Test.Data Test.Data2 @@ -110,7 +114,7 @@ test-suite spec Test.Data2.Flat Test.Data.Values --- Tests embedded in haddock docs (won't compile with ghcjs) +-- Tests embedded in code documentation (won't compile with ghcjs) -- test-suite docs -- default-language: Haskell2010 -- type: exitcode-stdio-1.0 @@ -118,19 +122,20 @@ test-suite spec -- build-depends: base, doctest>=0.11.2,filemanip>=0.3.6.3 -- HS-Source-Dirs: test -benchmark sbench - main-is: Mini.hs - type: exitcode-stdio-1.0 - default-language: Haskell2010 - build-depends: - base - , deepseq - ,criterion - ,bytestring,text,containers,process,filepath,statistics,directory - -- ,timeit - ,flat - hs-source-dirs: benchmarks test - ghc-options: -O2 -dumpdir /tmp/dump -ddump-to-file -dsuppress-all -ddump-simpl -fprint-potential-instances - -- cpp-options: -DENUM_LARGE - other-modules: - Test.E,Test.Data,Test.Data.Flat,Test.Data.Values,Test.Data2,Test.Data2.Flat,Test.E.Flat,Report +-- Simple benchmark (won't compile with ghcjs) +-- benchmark sbench +-- main-is: Mini.hs +-- type: exitcode-stdio-1.0 +-- default-language: Haskell2010 +-- build-depends: +-- base +-- , deepseq +-- ,criterion +-- ,bytestring,text,containers,process,filepath,statistics,directory +-- -- ,timeit +-- ,flat +-- hs-source-dirs: benchmarks test +-- ghc-options: -O2 -dumpdir /tmp/dump -ddump-to-file -dsuppress-all -ddump-simpl -fprint-potential-instances +-- -- cpp-options: -DENUM_LARGE +-- other-modules: +-- Test.E,Test.Data,Test.Data.Flat,Test.Data.Values,Test.Data2,Test.Data2.Flat,Test.E.Flat,Report diff --git a/src/README.lhs b/src/README.lhs index 0017880..a54b49d 100644 --- a/src/README.lhs +++ b/src/README.lhs @@ -101,28 +101,19 @@ Should also work with (not recently tested): * [ghc](https://www.haskell.org/ghc/) 7.10.3/LLVM 3.5.2 (Arm7) #### [GHCJS](https://github.com/ghcjs/ghcjs) - -Tested with: - -``` -compiler: ghcjs-0.2.1.9007019_ghc-8.0.1 -compiler-check: match-exact -setup-info: - ghcjs: - source: - ghcjs-0.2.1.9007019_ghc-8.0.1: - url: http://ghcjs.tolysz.org/ghc-8.0-2017-02-05-lts-7.19-9007019.tar.gz - sha1: d2cfc25f9cda32a25a87d9af68891b2186ee52f9 -``` Passes all tests in the `flat` testsuite, except for those relative to short bytestrings (Data.ByteString.Short) that are unsupported by `ghcjs`. -If you use a different version of `ghcjs`, you are advised to run the full test suite by setting your compiler in `stack-ghcjs.yaml` and then running: +Check [stack-ghcjs.yaml](https://github.com/Quid2/flat/blob/master/stack-ghcjs.yaml) to see with what versions of `ghcjs` it has been tested. + +If you use a different version of `ghcjs`, you might want to run the test suite by setting your compiler in [stack-ghcjs.yaml](https://github.com/Quid2/flat/blob/master/stack-ghcjs.yaml) and then running: `stack test --stack-yaml=stack-ghcjs.yaml` NOTE: Versions prior to 0.33 encode `Double` values incorrectly when they are not aligned with a byte boundary. +NOTE: A [native TypeScript/JavaScript version](https://github.com/Quid2/ts) of `flat` is under development. + #### [ETA](https://eta-lang.org/) It builds (with etlas 1.5.0.0 and eta eta-0.8.6b2 under macOS Sierra) and seems to be working, though the full test suite could not be run due to Eta's issues compiling some of the test suite dependencies. diff --git a/stack-ghcjs.yaml b/stack-ghcjs.yaml index 1bbde8f..ec48a2a 100644 --- a/stack-ghcjs.yaml +++ b/stack-ghcjs.yaml @@ -1,3 +1,40 @@ +# GHCJS version used for testing + +# Requires cabal 1.24.2.0 to build correctly +resolver: lts-7.19 +compiler: ghcjs-0.2.1.9007019_ghc-8.0.1 +compiler-check: match-exact +setup-info: + ghcjs: + source: + ghcjs-0.2.1.9007019_ghc-8.0.1: + url: http://ghcjs.tolysz.org/ghc-8.0-2017-02-05-lts-7.19-9007019.tar.gz + sha1: d2cfc25f9cda32a25a87d9af68891b2186ee52f9 + + +# Requires cabal 1.24.2.0 to build correctly +# resolver: lts-8.11 +# compiler: ghcjs-0.2.1.9008011_ghc-8.0.2 +# compiler-check: match-exact +# setup-info: +# ghcjs: +# source: +# ghcjs-0.2.1.9008011_ghc-8.0.2: +# url: https://github.com/matchwood/ghcjs-stack-dist/raw/master/ghcjs-0.2.1.9008011.tar.gz +# sha1: a72a5181124baf64bcd0e68a8726e65914473b3b + + +# Requires cabal-2.0.1.1 to build correctly +# resolver: lts-9.21 +# compiler: ghcjs-0.2.1.9009021_ghc-8.0.2 +# compiler-check: match-exact +# setup-info: +# ghcjs: +# source: +# ghcjs-0.2.1.9009021_ghc-8.0.2: +# url: https://github.com/matchwood/ghcjs-stack-dist/raw/master/ghcjs-0.2.1.9009021.tar.gz +# sha1: b1740c3c99e5039ac306702894cd6e58283f4d31 + packages: - '.' @@ -11,7 +48,6 @@ packages: extra-deps: - happy-1.19.5 # required to avoid a stack bug -#- QuickCheck-2.12.6.1@sha256:95b4e3b01033bf7d2ad21d0085266dba378477ac88e3d11ff238fc9db2575e6d - QuickCheck-2.11.3@sha256:e4c56f52532c993fc4460aeac7a2543dc03a68fba36eff420f3294d4d2622416 - tasty-1.1.0.4@sha256:1310ceed449b3227614b329a1672a2c5bb046cb49e281996523567b3b0ad9ecc - tasty-quickcheck-0.10@sha256:9ddbacf1504bbbc4b99ab447d26651ad8454b69ceced3486e4623dccb89fb3d9 @@ -20,37 +56,4 @@ extra-deps: flags: tasty: - clock: false - -# Requires cabal 1.24.2.0 to build correctly -# resolver: lts-7.19 -# compiler: ghcjs-0.2.1.9007019_ghc-8.0.1 -# compiler-check: match-exact -# setup-info: -# ghcjs: -# source: -# ghcjs-0.2.1.9007019_ghc-8.0.1: -# url: http://ghcjs.tolysz.org/ghc-8.0-2017-02-05-lts-7.19-9007019.tar.gz -# sha1: d2cfc25f9cda32a25a87d9af68891b2186ee52f9 - - -# Requires cabal 1.24.2.0 to build correctly -# resolver: lts-8.11 -# compiler: ghcjs-0.2.1.9008011_ghc-8.0.2 -# compiler-check: match-exact -# setup-info: -# ghcjs: -# source: -# ghcjs-0.2.1.9008011_ghc-8.0.2: -# url: https://github.com/matchwood/ghcjs-stack-dist/raw/master/ghcjs-0.2.1.9008011.tar.gz -# sha1: a72a5181124baf64bcd0e68a8726e65914473b3b - -resolver: lts-9.21 -compiler: ghcjs-0.2.1.9009021_ghc-8.0.2 -compiler-check: match-exact -setup-info: - ghcjs: - source: - ghcjs-0.2.1.9009021_ghc-8.0.2: - url: https://github.com/matchwood/ghcjs-stack-dist/raw/master/ghcjs-0.2.1.9009021.tar.gz - sha1: b1740c3c99e5039ac306702894cd6e58283f4d31 + clock: false \ No newline at end of file