ascii-progress 0.3.2.0 → 0.3.3.0
raw patch · 3 files changed
+41/−3 lines, 3 filesnew-component:exe:npm-examplePVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ascii-progress.cabal +19/−1
- bin/NpmExample.hs +19/−0
- lib/System/Console/AsciiProgress/Internal.hs +3/−2
ascii-progress.cabal view
@@ -1,5 +1,5 @@ name: ascii-progress-version: 0.3.2.0+version: 0.3.3.0 synopsis: A simple progress bar for the console. description: A simple Haskell progress bar for the console. Heavily borrows from TJ@@ -17,6 +17,7 @@ category: System build-type: Simple cabal-version: >=1.10+ source-repository head type: git location: git://github.com/yamadapc/haskell-ascii-progress@@ -51,6 +52,23 @@ , time >= 1.4.0.1 hs-source-dirs: lib , bin++executable npm-example+ main-is: NpmExample.hs+ default-language: Haskell2010++ if !flag(examples)+ buildable: False+ else+ buildable: True+ build-depends: concurrent-output >= 1.7+ , async >= 2.0.1.5+ , base >=4 && <5+ , data-default >= 0.5.3+ , time >= 1.4.0.1+ hs-source-dirs: lib+ , bin+ executable download-example main-is: DownloadExample.hs
+ bin/NpmExample.hs view
@@ -0,0 +1,19 @@+import Control.Concurrent (threadDelay)+import Control.Monad (unless)+import System.Console.AsciiProgress++main :: IO ()+main = displayConsoleRegions $ do+ pg <- newProgressBar def { pgWidth = 100+ , pgPendingChar = '░'+ , pgCompletedChar = '█'+ , pgFormat = "Working ╢:bar╟"+ }+ loop pg+ where+ loop pg = do+ b <- isComplete pg+ unless b $ do+ threadDelay $ 200 * 1000+ tick pg+ loop pg
lib/System/Console/AsciiProgress/Internal.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE MagicHash #-} {-# LANGUAGE RecordWildCards #-}-{-# LANGUAGE UnboxedTuples #-} module System.Console.AsciiProgress.Internal where @@ -187,5 +186,7 @@ if success then return v else readMVar mv- Just o -> return o+ Just o -> do+ _ <- tryPutMVar mv o+ return o