packages feed

config-value 0.8.2.1 → 0.8.3

raw patch · 9 files changed

+32/−9 lines, 9 filesdep ~basedep ~containersdep ~textPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, containers, text

API changes (from Hackage documentation)

+ Config: prettyInline :: Value a -> Doc

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+0.8.3+---+* Add `prettyInline` for layout-free pretty-printing+ 0.8.2.1 --- * Fix pretty-printing bug with long string literals
config-value.cabal view
@@ -1,6 +1,6 @@ cabal-version:       2.2 name:                config-value-version:             0.8.2.1+version:             0.8.3 synopsis:            Simple, layout-based value language similar to YAML or JSON license:             MIT license-file:        LICENSE@@ -40,7 +40,7 @@     Config.Value    build-depends:-    base       >= 4.8     && < 4.17,+    base       >= 4.8     && < 4.18,     array      >= 0.4     && < 0.6,     containers >= 0.5     && < 0.7,     pretty     >= 1.1.1.0 && < 1.2,
config-value.vim view
@@ -39,3 +39,7 @@ hi def link cvComment                     Comment  let b:current_syntax = "config-value"++setlocal commentstring=--%s+setlocal comments=:--+let b:undo_ftplugin = "setl com< commentstring<"
src/Config.hs view
@@ -246,6 +246,7 @@    -- * Pretty-printing   , pretty+  , prettyInline    -- * Types   , Section(..)@@ -267,7 +268,7 @@ import           Config.Number (Number, numberToInteger, numberToRational, integerToNumber, rationalToNumber) import           Config.Value  (Atom(..), Value(..), Section(..), valueAnn) import           Config.Parser (parseValue)-import           Config.Pretty (pretty)+import           Config.Pretty (pretty, prettyInline) import           Config.Lexer  (scanTokens) import           Config.Tokens (Error(..), Position(..), Located(..), layoutPass, Token) import qualified Config.Tokens as T
src/Config/Macro.hs view
@@ -65,7 +65,7 @@ top2: $x                     -- BAD: $x no longer in scope @ -Macros are expanded at there definition site. All variables are resolved before+Macros are expanded at their definition site. All variables are resolved before adding the new variable into the environment. Variables are lexically scoped rather than dynamically scoped. @@ -86,7 +86,7 @@  = Sections splicing -One sections value can be spliced into another sections value using the @\@spilce@+One sections value can be spliced into another sections value using the @\@splice@ directive. It is an error to splice a value that is not a key-value sections.  @
src/Config/Number.hs view
@@ -1,4 +1,4 @@-{-# Language DeriveDataTypeable, DeriveGeneric #-}+{-# Language DeriveDataTypeable, DeriveGeneric, Safe #-} {-| Module      : Config.Number Description : Scientific-notation numbers with explicit radix
src/Config/Pretty.hs view
@@ -1,5 +1,6 @@+{-# Language Safe #-} -- | Pretty-printing implementation for 'Value'-module Config.Pretty (pretty) where+module Config.Pretty (pretty, prettyInline) where  import           Data.Char (isPrint, isDigit,intToDigit) import           Data.List (mapAccumL)@@ -94,3 +95,15 @@ isBig (Sections _ (_:_)) = True isBig (List _ (_:_))     = True isBig _                  = False++-- | Pretty-printer that uses no layout for sections or lists.+prettyInline :: Value a -> Doc+prettyInline value =+  case value of+    Number _ n    -> prettyNumber n+    Text _ t      -> prettyText (Text.unpack t)+    Atom _ t      -> text (Text.unpack (atomName t))+    List _ xs     -> brackets (list (map prettyInline xs))+    Sections _ xs -> braces (list [text (Text.unpack k) <> colon <> prettyInline v | Section _ k v <- xs])+  where+    list = hcat . punctuate comma
src/Config/Tokens.hs view
@@ -1,3 +1,4 @@+{-# Language Safe #-} -- | This module provides the token type used in the lexer and -- parser and provides the extra pass to insert layout tokens. module Config.Tokens@@ -10,7 +11,7 @@   ) where  import Data.Text (Text)-import Config.Number+import Config.Number (Number)  -- | A position in a text file data Position = Position
src/Config/Value.hs view
@@ -1,4 +1,4 @@-{-# Language DeriveGeneric, DeriveTraversable, DeriveDataTypeable #-}+{-# Language DeriveGeneric, DeriveTraversable, DeriveDataTypeable, Safe #-}  -- | This module provides the types used in this package for configuration. -- Visit "Config.Parser" to parse values of this type in a convenient