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

various refactoring; GHC 9.4 support #29

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/haskell.yml
Expand Up @@ -13,9 +13,9 @@ jobs:
strategy:
matrix:
cabal: ["3.6"]
ghc: ["8.6.5", "8.8.4", "8.10.7", "9.0.2", "9.2.3"]
ghc: ["8.6.5", "8.8.4", "8.10.7", "9.0.2", "9.2.3", "9.4.2"]
env:
CONFIG: "--enable-tests --enable-benchmarks"
CONFIG: "--enable-tests --enable-benchmarks --flags llvm"
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/cache@v2
Expand Down
8 changes: 4 additions & 4 deletions bench/Bench.hs
Expand Up @@ -10,7 +10,7 @@ import qualified Data.ByteString.Char8 as B
import qualified Attoparsec
import qualified Megaparsec
import qualified Parsec
import qualified FPStateful
--import qualified FPStateful
import qualified FPBasic
import qualified ReadInteger

Expand All @@ -31,23 +31,23 @@ main :: IO ()
main = defaultMain [
bgroup "sexp" [
bench "fpbasic" $ whnf FPBasic.runSexp sexpInp,
bench "fpstateful" $ whnf FPStateful.runSexp sexpInp,
--bench "fpstateful" $ whnf FPStateful.runSexp sexpInp,
bench "attoparsec" $ whnf Attoparsec.runSexp sexpInp,
bench "megaparsec" $ whnf Megaparsec.runSexp sexpInp,
bench "parsec" $ whnf Parsec.runSexp sexpInp
],

bgroup "long keyword" [
bench "fpbasic" $ whnf FPBasic.runLongws longwsInp,
bench "fpstateful" $ whnf FPStateful.runLongws longwsInp,
--bench "fpstateful" $ whnf FPStateful.runLongws longwsInp,
bench "attoparsec" $ whnf Attoparsec.runLongws longwsInp,
bench "megaparsec" $ whnf Megaparsec.runLongws longwsInp,
bench "parsec" $ whnf Parsec.runLongws longwsInp
],

bgroup "numeral csv" [
bench "fpbasic" $ whnf FPBasic.runNumcsv numcsvInp,
bench "fpstateful" $ whnf FPStateful.runNumcsv numcsvInp,
--bench "fpstateful" $ whnf FPStateful.runNumcsv numcsvInp,
bench "attoparsec" $ whnf Attoparsec.runNumcsv numcsvInp,
bench "megaparsec" $ whnf Megaparsec.runNumcsv numcsvInp,
bench "parsec" $ whnf Parsec.runNumcsv numcsvInp
Expand Down
8 changes: 4 additions & 4 deletions bench/FPBasic.hs
Expand Up @@ -7,18 +7,18 @@ module FPBasic (
import FlatParse.Basic

ws = many_ $(switch [| case _ of " " -> pure (); "\n" -> pure () |])
open = $(char '(') >> ws
close = $(char ')') >> ws
open = $(getCharOf '(') >> ws
close = $(getCharOf ')') >> ws
ident = some_ (satisfyASCII_ isLatinLetter) >> ws
sexp = branch open (some_ sexp >> close) ident
src = sexp >> eof
runSexp = runParser src

longw = $(string "thisisalongkeyword")
longw = $(getStringOf "thisisalongkeyword")
longws = some_ (longw >> ws) >> eof
runLongws = runParser longws

numeral = some_ (satisfyASCII_ isDigit) >> ws
comma = $(char ',') >> ws
comma = $(getCharOf ',') >> ws
numcsv = numeral >> many_ (comma >> numeral) >> eof
runNumcsv = runParser numcsv
5 changes: 4 additions & 1 deletion bench/FPStateful.hs
@@ -1,4 +1,4 @@

{-
module FPStateful (
runSexp
, runLongws
Expand All @@ -25,3 +25,6 @@ numeral = some_ (satisfyASCII_ isDigit) >> ws
comma = $(char ',') >> ws
numcsv = numeral >> many_ (comma >> numeral) >> eof
runNumcsv = runParser numcsv () 0
-}

module FPStateful where
4 changes: 2 additions & 2 deletions bench/ReadInteger.hs
Expand Up @@ -3,5 +3,5 @@ module ReadInteger where

import FlatParse.Basic as FPBasic

readInt = runParser FPBasic.readInt
readInteger = runParser FPBasic.readInteger
readInt = runParser FPBasic.getAsciiDecimalInt
readInteger = runParser FPBasic.getAsciiDecimalInteger
24 changes: 17 additions & 7 deletions flatparse.cabal
@@ -1,6 +1,6 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.34.4.
-- This file has been generated from package.yaml by hpack version 0.35.0.
--
-- see: https://github.com/sol/hpack

Expand Down Expand Up @@ -44,11 +44,21 @@ flag llvm
library
exposed-modules:
FlatParse.Basic
FlatParse.Basic.Addr
FlatParse.Basic.Base
FlatParse.Basic.Integers
FlatParse.Basic.Integers.Varints
FlatParse.Basic.Other
FlatParse.Basic.Parser
FlatParse.Basic.Position
FlatParse.Basic.Strings
FlatParse.BasicString
FlatParse.Common.Assorted
FlatParse.Common.Numbers
FlatParse.Common.Position
FlatParse.Common.Trie
FlatParse.Examples.BasicLambda.Lexer
FlatParse.Examples.BasicLambda.Parser
FlatParse.Internal
FlatParse.Internal.UnboxedNumerics
FlatParse.Stateful
other-modules:
Paths_flatparse
hs-source-dirs:
Expand All @@ -71,11 +81,11 @@ library
, containers
, integer-gmp
, template-haskell
default-language: Haskell2010
if flag(dump)
ghc-options: -ddump-simpl -ddump-stg-final -ddump-cmm -dsuppress-all -dno-suppress-type-signatures -ddump-to-file
if flag(llvm)
ghc-options: -fllvm
default-language: Haskell2010

test-suite spec
type: exitcode-stdio-1.0
Expand Down Expand Up @@ -105,11 +115,11 @@ test-suite spec
, flatparse
, hspec
, quickcheck-instances
default-language: Haskell2010
if flag(dump)
ghc-options: -ddump-simpl -ddump-stg-final -ddump-cmm -dsuppress-all -dno-suppress-type-signatures -ddump-to-file
if flag(llvm)
ghc-options: -fllvm
default-language: Haskell2010

benchmark bench
type: exitcode-stdio-1.0
Expand Down Expand Up @@ -146,8 +156,8 @@ benchmark bench
, megaparsec
, parsec
, primitive
default-language: Haskell2010
if flag(dump)
ghc-options: -ddump-simpl -ddump-stg-final -ddump-cmm -dsuppress-all -dno-suppress-type-signatures -ddump-to-file
if flag(llvm)
ghc-options: -fllvm
default-language: Haskell2010