gigaparsec-0.2.0.0: benchmarks/Main.hs
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE StandaloneDeriving, DeriveAnyClass, DeriveGeneric #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Main (main) where
import Gauge (defaultMain, bench, nf)
import Text.Gigaparsec (Parsec, Result(Success, Failure), parse, atomic, (<|>))
import Text.Gigaparsec.Char (string)
import Control.DeepSeq (NFData)
import GHC.Generics (Generic)
p :: Parsec String
p = atomic (string "hello wold") <|> atomic (string "hi") <|> string "hello world"
deriving stock instance Generic (Result e a)
deriving anyclass instance (NFData a, NFData e) => NFData (Result e a)
main :: IO ()
main = defaultMain [
bench "consumption" $ nf (parse @String p) "hello world"
]