packages feed

hw-parser (empty) → 0.0.0.1

raw patch · 5 files changed

+123/−0 lines, 5 filesdep +attoparsecdep +basedep +bytestringsetup-changed

Dependencies added: attoparsec, base, bytestring, hw-prim, mono-traversable, text

Files

+ LICENSE view
@@ -0,0 +1,30 @@+Copyright John Ky (c) 2016++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * Redistributions in binary form must reproduce the above+      copyright notice, this list of conditions and the following+      disclaimer in the documentation and/or other materials provided+      with the distribution.++    * Neither the name of Author name here nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ README.md view
@@ -0,0 +1,2 @@+# hw-parser+[![v0.0-branch](https://circleci.com/gh/haskell-works/hw-parser/tree/v0.0-branch.svg?style=svg)](https://circleci.com/gh/haskell-works/hw-parser/tree/v0.0-branch)
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ hw-parser.cabal view
@@ -0,0 +1,31 @@+name:                   hw-parser+version:                0.0.0.1+synopsis:               Conduits for tokenizing streams.+description:            Please see README.md+homepage:               http://github.com/haskell-works/hw-parser#readme+license:                BSD3+license-file:           LICENSE+author:                 John Ky+maintainer:             newhoggy@gmail.com+copyright:              2016 John Ky+category:               Data, Parser+build-type:             Simple+extra-source-files:     README.md+cabal-version:          >= 1.10++library+  hs-source-dirs:       src+  exposed-modules:      HaskellWorks.Data.Parser+  build-depends:        base                            >= 4.7  && < 5+                      , attoparsec+                      , bytestring+                      , hw-prim+                      , mono-traversable+                      , text++  default-language:     Haskell2010+  ghc-options:          -rtsopts -with-rtsopts=-N -Wall -O2 -Wall -msse4.2++source-repository head+  type:     git+  location: https://github.com/haskell-works/hw-parser
+ src/HaskellWorks/Data/Parser.hs view
@@ -0,0 +1,58 @@+module HaskellWorks.Data.Parser+  ( Parser(..)+  ) where++import qualified Data.Attoparsec.ByteString                as ABS+import qualified Data.Attoparsec.ByteString.Char8          as BC+import qualified Data.Attoparsec.Text                      as AT+import qualified Data.Attoparsec.Types                     as T+import           Data.ByteString                           (ByteString)+import           Data.MonoTraversable+import           Data.Text                                 (Text)+import           HaskellWorks.Data.Char.IsChar++class MonoTraversable t => Parser t where+  satisfy :: (Element t -> Bool) -> T.Parser t (Element t)+  satisfyWith :: (Element t -> a) -> (a -> Bool) -> T.Parser t a+  satisfyChar :: (Char -> Bool) -> T.Parser t Char+  string :: t -> T.Parser t t+  try :: T.Parser t a -> T.Parser t a+  char :: Char -> T.Parser t Char+  (<?>) :: T.Parser t Char -> String -> T.Parser t Char+  rational :: Fractional f => T.Parser t f++instance Parser ByteString where+  satisfy = ABS.satisfy+  satisfyWith = ABS.satisfyWith+  satisfyChar = ABS.satisfyWith toChar+  string = ABS.string+  try = ABS.try+  char = BC.char+  (<?>) = (BC.<?>)+  rational = BC.rational+  {-# INLINABLE satisfy     #-}+  {-# INLINABLE satisfyWith #-}+  {-# INLINABLE satisfyChar #-}+  {-# INLINABLE string      #-}+  {-# INLINABLE try         #-}+  {-# INLINABLE char        #-}+  {-# INLINABLE (<?>)       #-}+  {-# INLINABLE rational    #-}++instance Parser Text where+  satisfy = AT.satisfy+  satisfyWith = AT.satisfyWith+  satisfyChar = AT.satisfyWith toChar+  string = AT.string+  try = AT.try+  char = AT.char+  (<?>) = (AT.<?>)+  rational = AT.rational+  {-# INLINABLE satisfy     #-}+  {-# INLINABLE satisfyWith #-}+  {-# INLINABLE satisfyChar #-}+  {-# INLINABLE string      #-}+  {-# INLINABLE try         #-}+  {-# INLINABLE char        #-}+  {-# INLINABLE (<?>)       #-}+  {-# INLINABLE rational    #-}