forked from roelvandijk/usb-id-database
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replaced ByteStrings with Strings (3x faster parsing), Added Binary i…
…nstance for IDDB Ignore-this: 73db464310212ab1d718f18da5f04ff9 darcs-hash:20090911150212-b004c-d2e3406e6fa212cb1d87a27c8f7fb12c901dfb83.gz
- Loading branch information
1 parent
99cc0b0
commit 570db27
Showing
6 changed files
with
141 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
module System.USB.IDDB.Misc | ||
( BSParser | ||
, eitherMaybe | ||
( eitherMaybe | ||
, swap | ||
, restOfLine | ||
) where | ||
|
||
import Data.ByteString (ByteString) | ||
import Data.String.UTF8 (UTF8) | ||
import Parsimony (Parser, manyTill) | ||
import Parsimony.Char (anyChar, newline) | ||
|
||
|
||
type BSParser = Parser (UTF8 ByteString) | ||
|
||
|
||
eitherMaybe :: Either e a -> Maybe a | ||
eitherMaybe = either (const Nothing) Just | ||
|
||
restOfLine :: BSParser String | ||
swap :: (a, b) -> (b, a) | ||
swap = uncurry $ flip (,) | ||
|
||
restOfLine :: Parser String String | ||
restOfLine = manyTill anyChar newline | ||
|
Oops, something went wrong.