usb-id-database 0.4.0.1 → 0.4.0.2
raw patch · 4 files changed
+58/−36 lines, 4 filesdep ~base-unicode-symbolsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base-unicode-symbols
API changes (from Hackage documentation)
Files
- System/USB/IDDB/Base.hs +7/−7
- System/USB/IDDB/LinuxUsbIdRepo.hs +37/−15
- System/USB/IDDB/UsbDotOrg.hs +12/−12
- usb-id-database.cabal +2/−2
System/USB/IDDB/Base.hs view
@@ -34,15 +34,15 @@ where -- base-import Control.Monad ( (=<<), fmap )-import Data.Char ( String )-import Data.Function ( ($) )-import Data.Int ( Int )-import Data.Maybe ( Maybe )-import Data.Tuple ( fst, snd )+import Control.Monad ( (=<<), fmap )+import Data.Char ( String )+import Data.Function ( ($) )+import Data.Int ( Int )+import Data.Maybe ( Maybe )+import Data.Tuple ( fst, snd ) -- base-unicode-symbols-import Prelude.Unicode ( (∘) )+import Data.Function.Unicode ( (∘) ) -- containers import qualified Data.IntMap as IM
System/USB/IDDB/LinuxUsbIdRepo.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE UnicodeSyntax #-} @@ -18,21 +19,31 @@ ------------------------------------------------------------------------------- -- base-import Control.Arrow ( second )-import Control.Monad ( (>>=), (>>), fail, fmap, return )-import Data.Bool ( Bool, not )-import Data.Char ( String, isSpace )-import Data.Function ( ($), id )-import Data.Int ( Int )-import Data.List ( all, filter, map, isPrefixOf, lines, unlines )-import Data.Maybe ( Maybe, fromJust )-import Data.Tuple ( fst )-import Numeric ( readHex )-import Prelude ( Num, error, fromInteger )-import System.IO ( IO, FilePath, readFile )+import Control.Arrow ( second )+import Control.Monad ( (>>=), (>>), fail, fmap, return )+import Data.Bool ( Bool, not )+import Data.Char ( String, isSpace )+import Data.Function ( ($), id )+import Data.Int ( Int )+import Data.List ( all, filter, length, map+ , isPrefixOf, lines, unlines + )+import Data.Maybe ( Maybe, fromJust )+import Data.Tuple ( fst )+import Numeric ( readHex )+import Prelude ( Num, error, fromInteger, seq )+import System.IO ( IO, FilePath )+#if MIN_VERSION_base(4,2,0)+import System.IO ( IOMode(ReadMode)+ , withFile, hSetEncoding, latin1, hGetContents+ )+#else+import System.IO ( readFile )+#endif -- base-unicode-symbols-import Prelude.Unicode ( (∘), (∧) )+import Data.Bool.Unicode ( (∧) )+import Data.Function.Unicode ( (∘) ) -- containers import qualified Data.IntMap as IM@@ -40,11 +51,11 @@ -- parsimony import Parsimony-import Parsimony.Char ( char, string, hexDigit, tab )+import Parsimony.Char ( char, string, hexDigit, tab ) -- usb-id-database import System.USB.IDDB.Base-import System.USB.IDDB.Misc ( eitherMaybe, swap, restOfLine )+import System.USB.IDDB.Misc ( eitherMaybe, swap, restOfLine ) -------------------------------------------------------------------------------@@ -177,7 +188,18 @@ -- |Load a database from file. If the file can not be read for some reason an -- error will be thrown. fromFile ∷ FilePath → IO (Maybe IDDB)+#if MIN_VERSION_base(4,2,0)+fromFile fp = withFile fp ReadMode + $ \h → do hSetEncoding h latin1+ contents ← hGetContents h+ -- Bit ugly, but necessary to force the+ -- evaluation of contents before it is parsed+ -- as a database. Otherwise you'll get an+ -- empty database.+ length contents `seq` (return $ parseDb contents)+#else fromFile = fmap parseDb ∘ readFile+#endif -- |Load a database from a snapshot of the linux-usb.org database which is -- supplied with the package.
System/USB/IDDB/UsbDotOrg.hs view
@@ -18,16 +18,16 @@ ------------------------------------------------------------------------------- -- base-import Control.Monad ( (>>=), (>>), fail, fmap, return )-import Data.Char ( String )-import Data.Function ( ($) )-import Data.Int ( Int )-import Data.Maybe ( Maybe, fromJust )-import System.IO ( IO, FilePath, readFile )-import Text.Read ( read )+import Control.Monad ( (>>=), fail, fmap, return )+import Data.Char ( String )+import Data.Function ( ($) )+import Data.Int ( Int )+import Data.Maybe ( Maybe, fromJust )+import System.IO ( IO, FilePath, readFile )+import Text.Read ( read ) -- base-unicode-symbols-import Prelude.Unicode ( (∘) )+import Data.Function.Unicode ( (∘) ) -- containers import qualified Data.IntMap as IM ( fromList )@@ -38,11 +38,11 @@ -- parsimony import Parsimony-import Parsimony.Char ( char, digit )+import Parsimony.Char ( char, digit ) -- usb-id-database-import System.USB.IDDB.Base ( IDDB(..), getDataFileName )-import System.USB.IDDB.Misc ( eitherMaybe, swap, restOfLine )+import System.USB.IDDB.Base ( IDDB(..), getDataFileName )+import System.USB.IDDB.Misc ( eitherMaybe, swap, restOfLine ) -------------------------------------------------------------------------------@@ -73,7 +73,7 @@ where vendorParser ∷ Parser String (Int, String) vendorParser = do vid ← many1 digit- char '|'+ _ ← char '|' name ← restOfLine return (read vid, name)
usb-id-database.cabal view
@@ -1,5 +1,5 @@ name: usb-id-database-version: 0.4.0.1+version: 0.4.0.2 cabal-version: >=1.6 build-type: Simple stability: provisional@@ -33,7 +33,7 @@ library build-depends: base >= 3.0.3.1 && < 4.3- , base-unicode-symbols == 0.1.*+ , base-unicode-symbols >= 0.1.1 && < 0.2 , bytestring == 0.9.* , containers < 0.4 , containers-unicode-symbols == 0.1.*