ls-usb 0.1.0.4 → 0.1.0.5
raw patch · 4 files changed
+50/−43 lines, 4 filesdep ~base-unicode-symbolsdep ~usb-safe
Dependency ranges changed: base-unicode-symbols, usb-safe
Files
- LICENSE +1/−1
- PrettyDevList.hs +32/−26
- ls-usb.cabal +4/−4
- ls-usb.hs +13/−12
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2009 - 2010 Roel van Dijk+Copyright (c) 2009–2010 Roel van Dijk All rights reserved.
PrettyDevList.hs view
@@ -1,6 +1,8 @@-{-# LANGUAGE RankNTypes #-}-{-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE UnicodeSyntax #-}+{-# LANGUAGE NoImplicitPrelude+ , RankNTypes+ , ScopedTypeVariables+ , UnicodeSyntax+ #-} module PrettyDevList ( PPStyle(..)@@ -20,25 +22,29 @@ ) -- base-import Control.Arrow ( (>>>) ) import Control.Exception ( catch )-import Control.Monad ( fmap, liftM, mapM, return )+import Control.Monad ( (>>=), fail, liftM, mapM, return ) import Data.Bool ( Bool(False, True) ) import Data.Char ( String, toLower )+import Data.Eq ( (==) ) import Data.Function ( ($), id )+import Data.Functor ( fmap ) import Data.Int ( Int ) import Data.List ( intersperse, length, map, maximum , partition, transpose, zipWith ) import Data.Maybe ( maybe ) import Data.Word ( Word8, Word16 )-import Prelude ( (+), fromIntegral )+import Prelude ( (+), fromIntegral, fromInteger, fromRational ) import System.IO ( IO ) import Text.Printf ( PrintfArg, printf ) import Text.Show ( Show, show ) -- base-unicode-symbols-import Prelude.Unicode ( (∘), (⋅), (≡) )+import Control.Arrow.Unicode ( (⋙) )+import Data.Function.Unicode ( (∘) )+import Data.Eq.Unicode ( (≡) )+import Prelude.Unicode ( (⋅) ) -- bytestring import Data.ByteString.Char8 ( ByteString, unpack )@@ -111,32 +117,32 @@ brightStyle ∷ PPStyle brightStyle = PPStyle- { sectionStyle = pretty >>> white >>> bold >>> underline+ { sectionStyle = pretty ⋙ white ⋙ bold ⋙ underline , fieldStyle = pretty- , usbNumStyle = pretty >>> yellow+ , usbNumStyle = pretty ⋙ yellow , usbStrStyle = pretty- , stringStyle = pretty >>> green- , descrStyle = pretty >>> cyan >>> dquotes- , descrAddrStyle = pretty >>> cyan >>> bold- , versionStyle = pretty >>> yellow- , addrStyle = pretty >>> magenta- , errorStyle = pretty >>> red- , errorDescrStyle = pretty >>> dullred+ , stringStyle = pretty ⋙ green+ , descrStyle = pretty ⋙ cyan ⋙ dquotes+ , descrAddrStyle = pretty ⋙ cyan ⋙ bold+ , versionStyle = pretty ⋙ yellow+ , addrStyle = pretty ⋙ magenta+ , errorStyle = pretty ⋙ red+ , errorDescrStyle = pretty ⋙ dullred } darkStyle ∷ PPStyle darkStyle = PPStyle- { sectionStyle = pretty >>> bold >>> underline+ { sectionStyle = pretty ⋙ bold ⋙ underline , fieldStyle = pretty- , usbNumStyle = pretty >>> onyellow+ , usbNumStyle = pretty ⋙ onyellow , usbStrStyle = pretty- , stringStyle = pretty >>> ongreen- , descrStyle = pretty >>> oncyan >>> dquotes- , descrAddrStyle = pretty >>> oncyan >>> bold- , versionStyle = pretty >>> onyellow- , addrStyle = pretty >>> onmagenta- , errorStyle = pretty >>> red- , errorDescrStyle = pretty >>> dullred+ , stringStyle = pretty ⋙ ongreen+ , descrStyle = pretty ⋙ oncyan ⋙ dquotes+ , descrAddrStyle = pretty ⋙ oncyan ⋙ bold+ , versionStyle = pretty ⋙ onyellow+ , addrStyle = pretty ⋙ onmagenta+ , errorStyle = pretty ⋙ red+ , errorDescrStyle = pretty ⋙ dullred } -------------------------------------------------------------------------------@@ -205,7 +211,7 @@ ppStringDesc _ _ 0 = return empty ppStringDesc style dev ix = catchUSBException ( with dev $ \devH →- liftM (descrStyle style)+ fmap (descrStyle style) $ getStrDescFirstLang devH ix stringBufferSize
ls-usb.cabal view
@@ -1,11 +1,11 @@ name: ls-usb-version: 0.1.0.4+version: 0.1.0.5 cabal-version: >= 1.6 build-type: Simple stability: beta author: Roel van Dijk <vandijk.roel@gmail.com> maintainer: vandijk.roel@gmail.com-copyright: 2009 - 2010 Roel van Dijk <vandijk.roel@gmail.com>+copyright: 2009–2010 Roel van Dijk <vandijk.roel@gmail.com> license: BSD3 license-file: LICENSE category: System@@ -20,11 +20,11 @@ executable ls-usb build-depends: ansi-wl-pprint >= 0.5.1 && < 0.6 , base >= 4.0 && < 4.3- , base-unicode-symbols == 0.1.*+ , base-unicode-symbols >= 0.1.1 && < 0.3 , bytestring >= 0.9.1 && < 0.10 , cmdargs == 0.1.* , usb == 0.3.*- , usb-safe >= 0.4 && < 0.6+ , usb-safe >= 0.4 && < 0.7 , usb-id-database >= 0.4.0.2 && < 0.5 ghc-options: -Wall -fno-warn-orphans main-is: ls-usb.hs
ls-usb.hs view
@@ -1,5 +1,4 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE UnicodeSyntax #-}+{-# LANGUAGE DeriveDataTypeable, NoImplicitPrelude, UnicodeSyntax #-} module Main where @@ -7,7 +6,7 @@ import Text.PrettyPrint.ANSI.Leijen ( putDoc, plain ) -- base-import Control.Monad ( (=<<) )+import Control.Monad ( (>>=), (>>), (=<<), fail ) import Data.Bool ( Bool(False, True), otherwise ) import Data.Data ( Data ) import Data.Function ( ($), const, id )@@ -20,7 +19,9 @@ import Text.Show ( Show ) -- base-unicode-symbols-import Prelude.Unicode ( (∘), (∧), (∨), (≡) )+import Data.Function.Unicode ( (∘) )+import Data.Bool.Unicode ( (∧), (∨) )+import Data.Eq.Unicode ( (≡) ) -- CmdArgs import System.Console.CmdArgs ( Mode@@ -78,7 +79,7 @@ & helpSuffix ["Please ensure you have sufficient rights before running with higher verbosity"] main ∷ IO ()-main = do opts ← cmdArgs "ls-usb 0.1.0.3, (C) Roel van Dijk 2009"+main = do opts ← cmdArgs "ls-usb 0.1.0.5, (C) Roel van Dijk 2009-2010" [defaultOpts] verbose ← isLoud db ← staticDb@@ -103,25 +104,25 @@ ------------------------------------------------------------------------------- -- Filters -type F a = a → Bool+type F α = α → Bool -- Construct a filter combinator from a binary boolean operator.-binBoolOpToFComb ∷ (Bool → Bool → Bool) → F a → F a → F a+binBoolOpToFComb ∷ (Bool → Bool → Bool) → F α → F α → F α binBoolOpToFComb (⊗) f g = \x → f x ⊗ g x -(<∨>) ∷ F a → F a → F a+(<∨>) ∷ F α → F α → F α (<∨>) = binBoolOpToFComb (∨) -(<∧>) ∷ F a → F a → F a+(<∧>) ∷ F α → F α → F α (<∧>) = binBoolOpToFComb (∧) -andF ∷ [F a] → F a+andF ∷ [F α] → F α andF = foldr (<∧>) (const True) -orF ∷ [F a] → F a+orF ∷ [F α] → F α orF = foldr (<∨>) (const False) -filterNonEmpty ∷ [F a] → F a+filterNonEmpty ∷ [F α] → F α filterNonEmpty [] = const True filterNonEmpty xs = foldr (<∨>) (const False) xs