packages feed

gvti 0.3.0.0 → 0.3.1.0

raw patch · 5 files changed

+57/−53 lines, 5 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Formatting: formatBStr :: Int -> Char -> String -> String
- Formatting: formatBothStr :: Int -> Int -> Char -> String -> String
- Formatting: formatEStr :: Int -> Char -> String -> String
- Formatting: formatLines :: Char -> [String] -> [String]
+ GVTI.Formatting: formatBStr :: Int -> Char -> String -> String
+ GVTI.Formatting: formatBothStr :: Int -> Int -> Char -> String -> String
+ GVTI.Formatting: formatEStr :: Int -> Char -> String -> String
+ GVTI.Formatting: formatLines :: Char -> [String] -> [String]

Files

ChangeLog.md view
@@ -24,3 +24,7 @@  * Third version. Switched to NoImplicitPrelude extension. Some minor code in messages improvements. Updated the dependencies boundaries. +## 0.3.1.0 -- 2023-02-02++* Third version revised A. Changed the name of the module Formatting to GVTI.Formatting to follow the semantics of the modules names.+
− Formatting.hs
@@ -1,49 +0,0 @@-{-# OPtIONS_HADDOCK show-extensions #-}-{-# LANGUAGE BangPatterns #-}--{-|-Module      : Formatting-Description : GraphViz Tabular Interface formatting functionality to be used with the @gvti -g@.-Copyright   : (c) Oleksandr Zhabenko, 2017-2023-License     : MIT-Maintainer  : oleksandr.zhabenko@yahoo.com-Stability   : Experimental---}--{-# LANGUAGE NoImplicitPrelude #-}--module Formatting where--import GHC.Base-import GHC.List-import GHC.Num ((+), (-))-import Text.Read (readMaybe)-import Data.Maybe (fromMaybe)-import Data.Char (isDigit)--formatBStr :: Int -> Char -> String -> String-formatBStr n x xs -  | n > 0 = (iterate (x:) xs) !! n-  | otherwise = xs--formatEStr :: Int -> Char -> String -> String-formatEStr m x xs -  | m > 0 = xs `mappend` replicate m x-  | otherwise = xs--formatBothStr :: Int -> Int -> Char -> String -> String-formatBothStr m n x = formatBStr m x . formatEStr n x-{-# INLINE formatBothStr  #-}--formatLines :: Char -> [String] -> [String]-formatLines x xss = map (\(xs,n,m) -> formatBothStr n m x $ xs) . zip3 ws j2s $ ms-  where (!js,!rs) = unzip . map (span isDigit) $ xss-        ws = map (dropWhile (== ',')) rs-        ll1s = map (length . filter (== x)) $ xss-        !j2s = map (\wws -> fromMaybe 0 (readMaybe wws::Maybe Int)) js-        lls = zipWith (+) ll1s j2s-        !mx = maximum lls-        !ms = zipWith (\x k -> mx - x - k) ll1s j2s-{-# INLINE formatLines #-}-
+ GVTI/Formatting.hs view
@@ -0,0 +1,49 @@+{-# OPtIONS_HADDOCK show-extensions #-}+{-# LANGUAGE BangPatterns #-}++{-|+Module      : GVTI.Formatting+Description : GraphViz Tabular Interface formatting functionality to be used with the @gvti -g@.+Copyright   : (c) Oleksandr Zhabenko, 2017-2023+License     : MIT+Maintainer  : oleksandr.zhabenko@yahoo.com+Stability   : Experimental++-}++{-# LANGUAGE NoImplicitPrelude #-}++module GVTI.Formatting where++import GHC.Base+import GHC.List+import GHC.Num ((+), (-))+import Text.Read (readMaybe)+import Data.Maybe (fromMaybe)+import Data.Char (isDigit)++formatBStr :: Int -> Char -> String -> String+formatBStr n x xs +  | n > 0 = (iterate (x:) xs) !! n+  | otherwise = xs++formatEStr :: Int -> Char -> String -> String+formatEStr m x xs +  | m > 0 = xs `mappend` replicate m x+  | otherwise = xs++formatBothStr :: Int -> Int -> Char -> String -> String+formatBothStr m n x = formatBStr m x . formatEStr n x+{-# INLINE formatBothStr  #-}++formatLines :: Char -> [String] -> [String]+formatLines x xss = map (\(xs,n,m) -> formatBothStr n m x $ xs) . zip3 ws j2s $ ms+  where (!js,!rs) = unzip . map (span isDigit) $ xss+        ws = map (dropWhile (== ',')) rs+        ll1s = map (length . filter (== x)) $ xss+        !j2s = map (\wws -> fromMaybe 0 (readMaybe wws::Maybe Int)) js+        lls = zipWith (+) ll1s j2s+        !mx = maximum lls+        !ms = zipWith (\x k -> mx - x - k) ll1s j2s+{-# INLINE formatLines #-}+
Main.hs view
@@ -23,7 +23,7 @@ import System.Directory import Data.List (isPrefixOf, lines, unlines) import Data.Char (isLetter, isDigit) -import Formatting (formatLines)+import GVTI.Formatting (formatLines)  main :: IO () main = do 
gvti.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                gvti-version:             0.3.0.0+version:             0.3.1.0 synopsis:            GraphViz Tabular Interface description:         Introduces a new file extension .gvti and is a special tabular or line-based GraphViz subset interface. Is a fork of the now deprecated mmsyn4 package. homepage:            https://hackage.haskell.org/package/gvti@@ -17,7 +17,7 @@ cabal-version:       >=1.10  library-  exposed-modules:     GVTI, Formatting+  exposed-modules:     GVTI, GVTI.Formatting   -- other-modules:   other-extensions:    BangPatterns, NoImplicitPrelude   build-depends:       base >=4.13 && <5, directory >=1.3.4.0 && <2, process >=1.6.5.1 && <2, mmsyn3 ==0.2.0.0@@ -26,7 +26,7 @@  executable gvti   main-is:             Main.hs-  other-modules:       GVTI, Formatting+  other-modules:       GVTI, GVTI.Formatting   other-extensions:    BangPatterns, NoImplicitPrelude   build-depends:       base >=4.13 && <5, directory >=1.3.4.0 && <2, process >=1.6.5.1 && <2, mmsyn3 ==0.2.0.0   -- hs-source-dirs: