diff --git a/Data/Attoparsec/ByteString/Char8.hs b/Data/Attoparsec/ByteString/Char8.hs index b4f6b57..6330eaa 100644 --- a/Data/Attoparsec/ByteString/Char8.hs +++ b/Data/Attoparsec/ByteString/Char8.hs @@ -151,8 +151,8 @@ import qualified Data.Attoparsec.Internal as I import qualified Data.ByteString as B8 import qualified Data.ByteString.Char8 as B -instance (a ~ B.ByteString) => IsString (Parser a) where - fromString = I.string . B.pack +instance a ~ () => IsString (Parser a) where + fromString = void . I.string . B.pack -- $encodings -- diff --git a/Data/Attoparsec/Text/Internal.hs b/Data/Attoparsec/Text/Internal.hs index 02f04fd..eaee966 100644 --- a/Data/Attoparsec/Text/Internal.hs +++ b/Data/Attoparsec/Text/Internal.hs @@ -66,7 +66,7 @@ module Data.Attoparsec.Text.Internal ) where import Control.Applicative ((<|>), (<$>), pure, (*>)) -import Control.Monad (when) +import Control.Monad (void, when) import Data.Attoparsec.Combinator (()) import Data.Attoparsec.Internal import Data.Attoparsec.Internal.Types hiding (Parser, Failure, Success) @@ -88,8 +88,8 @@ type Result = IResult Text type Failure r = T.Failure Text Buffer r type Success a r = T.Success Text Buffer a r -instance (a ~ Text) => IsString (Parser a) where - fromString = string . T.pack +instance a ~ () => IsString (Parser a) where + fromString = void . string . T.pack -- | The parser @satisfy p@ succeeds for any character for which the -- predicate @p@ returns 'True'. Returns the character that is diff --git a/attoparsec.cabal b/attoparsec.cabal index 6793556..b3ace6e 100644 --- a/attoparsec.cabal +++ b/attoparsec.cabal @@ -1,7 +1,7 @@ cabal-version: 2.0 -- 2.0 needed for internal libraries name: attoparsec -version: 0.14.4 +version: 0.15.0 license: BSD3 license-file: LICENSE category: Text, Parsing diff --git a/benchmarks/Genome.hs b/benchmarks/Genome.hs index 8a6e3b1..605487a 100644 --- a/benchmarks/Genome.hs +++ b/benchmarks/Genome.hs @@ -44,13 +44,13 @@ genome = bgroup "genome" [ geneTL = rechunkT 4 geneT searchBS :: B.Parser ByteString -searchBS = "caac" *> ("aaca" <|> "aact") +searchBS = "caac" *> (B.string "aaca" <|> B.string "aact") searchBSCI :: B.Parser ByteString searchBSCI = B.stringCI "CAAC" *> (B.stringCI "AACA" <|> B.stringCI "AACT") searchT :: T.Parser Text -searchT = "caac" *> ("aaca" <|> "aact") +searchT = "caac" *> (T.string "aaca" <|> T.string "aact") searchTCI :: T.Parser Text searchTCI = T.asciiCI "CAAC" *> (T.asciiCI "AACA" <|> T.asciiCI "AACT") diff --git a/changelog.md b/changelog.md index 086eac8..e52a110 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,9 @@ +# 0.15.0 + +* Change equational constraints: + - `a ~ Text => IsString (Parser a)` to `a ~ () => IsString (Parser a)` + - `a ~ ByteString => IsString (Parser a)` to `a ~ () => IsString (Parser a)` + # 0.14.4 * Fix a segmentation fault when built against `text-2.0` diff --git a/tests/QC/Simple.hs b/tests/QC/Simple.hs index 45975b6..062ad36 100644 --- a/tests/QC/Simple.hs +++ b/tests/QC/Simple.hs @@ -18,7 +18,7 @@ import qualified Data.Attoparsec.ByteString.Char8 as A t_issue75 = expect issue75 "ab" (A.Done "" "b") issue75 :: A.Parser ByteString -issue75 = "a" >> ("b" <|> "") +issue75 = "a" >> (A.string "b" <|> A.string "") expect :: (Show r, Eq r) => A.Parser r -> ByteString -> A.Result r -> Property expect p input wanted =