dzen-utils 0.1 → 0.1.1
raw patch · 2 files changed
+14/−12 lines, 2 filesdep ~basedep ~colourdep ~processPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, colour, process
API changes (from Hackage documentation)
- System.Dzen.Bars: bar :: (Num a, Enum a, Ord a) => BarText -> BarType -> (a, a) -> a -> DString
+ System.Dzen.Bars: bar :: (Num a, Enum a, Ord a, Show a) => BarText -> BarType -> (a, a) -> a -> DString
- System.Dzen.Bars: cbar :: (Num a, Enum a, Ord a) => BarText -> BarType -> (a, a) -> Printer a
+ System.Dzen.Bars: cbar :: (Num a, Enum a, Ord a, Show a) => BarText -> BarType -> (a, a) -> Printer a
- System.Dzen.Bars: cdbar :: (Num a, Enum a, Ord a) => Bool -> Width -> (a, a) -> Printer a
+ System.Dzen.Bars: cdbar :: (Num a, Enum a, Ord a, Show a) => Bool -> Width -> (a, a) -> Printer a
- System.Dzen.Bars: cgdbar :: (Num a, Enum a, Ord a) => Bool -> (Width, Height) -> Maybe DColour -> Maybe DColour -> Bool -> (a, a) -> Printer a
+ System.Dzen.Bars: cgdbar :: (Num a, Enum a, Ord a, Show a) => Bool -> (Width, Height) -> Maybe DColour -> Maybe DColour -> Bool -> (a, a) -> Printer a
- System.Dzen.Bars: dbar :: (Num a, Enum a, Ord a) => Bool -> Width -> (a, a) -> a -> DString
+ System.Dzen.Bars: dbar :: (Num a, Enum a, Ord a, Show a) => Bool -> Width -> (a, a) -> a -> DString
- System.Dzen.Bars: gdbar :: (Num a, Enum a, Ord a) => Bool -> (Width, Height) -> Maybe DColour -> Maybe DColour -> Bool -> (a, a) -> a -> DString
+ System.Dzen.Bars: gdbar :: (Num a, Enum a, Ord a, Show a) => Bool -> (Width, Height) -> Maybe DColour -> Maybe DColour -> Bool -> (a, a) -> a -> DString
- System.Dzen.Base: class Combine a b where { type family Combined a b :: *; }
+ System.Dzen.Base: class Combine a b where type family Combined a b :: *
- System.Dzen.Base: class Transform a
+ System.Dzen.Base: class Transform a where transform f = transformSt (\ st -> (st, f))
Files
- System/Dzen/Bars.hs +10/−10
- dzen-utils.cabal +4/−2
System/Dzen/Bars.hs view
@@ -52,7 +52,7 @@ maybeLeft True = AtLeft Percentage -- | Mimics the dbar utility. Uses the 'dbar_style'.-dbar :: (Num a, Enum a, Ord a)+dbar :: (Num a, Enum a, Ord a, Show a) => Bool -- ^ If @True@, write the percentage on the left. -> Width -- ^ Width of the bar interior. -> (a,a) -- ^ Minimum and maximum values.@@ -61,7 +61,7 @@ dbar p = bar (maybeLeft p) . dbar_style '=' -- | Mimics the dbar utility while getting the input dinamically.-cdbar :: (Num a, Enum a, Ord a) => Bool -> Width -> (a,a) -> Printer a+cdbar :: (Num a, Enum a, Ord a, Show a) => Bool -> Width -> (a,a) -> Printer a cdbar p = cbar (maybeLeft p) . dbar_style '=' -- | The style produced by the dbar utility.@@ -74,7 +74,7 @@ ,txtWidth = w} -- | Mimics the gdbar utility. Uses the 'gdbar_style'.-gdbar :: (Num a, Enum a, Ord a)+gdbar :: (Num a, Enum a, Ord a, Show a) => Bool -- ^ If @True@, write the percentage on the left. -> (Width, Height) -- ^ Size of the whole bar (excluding text). -> Maybe DColour -- ^ Filled colour (see 'grpFilled').@@ -87,7 +87,7 @@ gdbar p = (((bar (maybeLeft p) .) . ) .) . gdbar_style -- | Mimics the gdbar utility while getting the input dinamically.-cgdbar :: (Num a, Enum a, Ord a) => Bool -> (Width, Height)+cgdbar :: (Num a, Enum a, Ord a, Show a) => Bool -> (Width, Height) -> Maybe DColour -> Maybe DColour -> Bool -> (a,a) -> Printer a cgdbar p = (((cbar (maybeLeft p) .) . ) .) . gdbar_style @@ -195,7 +195,7 @@ -- > "[ ] 2% " -- -- so the padding always inserts the spaces on the outside.-bar :: (Num a, Enum a, Ord a) => BarText ->+bar :: (Num a, Enum a, Ord a, Show a) => BarText -> BarType -> (a,a) -> a -> DString bar txt bar_ r v = case txt of@@ -206,13 +206,13 @@ -- | 'bar' wrapped with 'simple' so that the value is -- taken from an input.-cbar :: (Num a, Enum a, Ord a) => BarText ->+cbar :: (Num a, Enum a, Ord a, Show a) => BarText -> BarType -> (a,a) -> Printer a cbar = ((simple .) .) . bar -- | Draws the text part of the bar.-barText :: (Num a, Enum a, Ord a) => BarTextType -> (a,a) -> a -> DString+barText :: (Num a, Enum a, Ord a, Show a) => BarTextType -> (a,a) -> a -> DString barText Absolute _ val = str $ show val barText Percentage range val = str $ (show . fst . fst $ barRound 100 range val) ++ "%"@@ -220,7 +220,7 @@ -- | Draws the bar itself.-barDraw :: (Num a, Enum a, Ord a) => BarType -> (a,a) -> a -> DString+barDraw :: (Num a, Enum a, Ord a, Show a) => BarType -> (a,a) -> a -> DString barDraw (Text {txtOpen = to ,txtFilled = tf ,txtMiddle = Just tm -- <<<<<<<<@@ -280,11 +280,11 @@ -- Values outside the range are clamped. The boolean returned -- is @True@ iff the value would be one more if we rounded -- half-up.-barRound :: (Num a, Enum a, Ord a) =>+barRound :: (Num a, Enum a, Ord a, Show a) => Width -> (a,a) -> a -> ((Int, Int), Bool) barRound w r n = let (f, b) = barRound' w r n in ((f, w - f), b) -barRound' :: (Num a, Enum a, Ord a) =>+barRound' :: (Num a, Enum a, Ord a, Show a) => Width -> (a,a) -> a -> (Int, Bool) barRound' w (mini,maxi) n | maxi < mini = error "System.Dzen.Bars.bar: max value is less than min."
dzen-utils.cabal view
@@ -1,6 +1,6 @@ cabal-version: >= 1.2.3 name: dzen-utils-version: 0.1+version: 0.1.1 synopsis: Utilities for creating inputs for dzen. category: System license: GPL@@ -22,7 +22,9 @@ toplevel module "System.Dzen". library- build-depends: base >= 4, colour >= 2.2, process >= 1.0+ build-depends: base >= 4 && < 5+ , colour >= 2.2 && < 3+ , process >= 1.0 && < 2 ghc-options: -Wall extensions: MultiParamTypeClasses,