prosidy 1.6.0.0 → 1.6.0.1
raw patch · 6 files changed
+133/−21 lines, 6 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Prosidy: type BlockRegion = Region (Series Block)
+ Prosidy: type InlineRegion = Region (Series Inline)
+ Prosidy: type LiteralRegion = Region Text
+ Prosidy.Types: type BlockRegion = Region (Series Block)
+ Prosidy.Types: type InlineRegion = Region (Series Inline)
+ Prosidy.Types: type LiteralRegion = Region Text
+ Prosidy.Types.Series: infixl 3 :>>:
+ Prosidy.Types.Series: infixl 5 :>:
+ Prosidy.Types.Series: infixr 3 :<<:
+ Prosidy.Types.Series: infixr 5 :<:
+ Prosidy.Types.Series: pattern (:<:) :: a -> Series a -> Series a
+ Prosidy.Types.Series: pattern Empty :: Series a
+ Prosidy.Types.Series: pattern NonEmpty :: SeriesNE a -> Series a
Files
- CHANGELOG +0/−13
- CHANGELOG.md +18/−0
- README.pro +42/−4
- prosidy.cabal +2/−2
- src/Prosidy/Types.hs +17/−1
- src/Prosidy/Types/Series.hs +54/−1
− CHANGELOG
@@ -1,13 +0,0 @@-# v1.6 _(2020-03-01)_-- Removed an erroneous `Monoid` constraint from `SeriesNE`-- Added locations to a few node types.-- Wrapped 'Text' nodes in 'Fragment'.--# v1.5.0.1 _(2020-02-24)_-- Added `CHANGELOG` to its own file.-- Included `CHANGELOG` and `README.pro` in the source distribution.-- Added an optic for fetching the name of a `Tag`.--# v1.5.0.0 _(2020-02-23)_-- Added tests for GHC 8.4.4 through 8.6.1.-- Initial stable release.
+ CHANGELOG.md view
@@ -0,0 +1,18 @@+# v1.6.0.1 _(2020-03-13)_+- Added patterns to `Series` and `SeriesNE` to make for easier pattern+ matching.+- Added the `BlockRegion`, `InlineRegion`, and `LiteralRegion` synonyms.++# v1.6 _(2020-03-01)_+- Removed an erroneous `Monoid` constraint from `SeriesNE`+- Added locations to a few node types.+- Wrapped 'Text' nodes in 'Fragment'.++# v1.5.0.1 _(2020-02-24)_+- Added `CHANGELOG` to its own file.+- Included `CHANGELOG` and `README.pro` in the source distribution.+- Added an optic for fetching the name of a `Tag`.++# v1.5.0.0 _(2020-02-23)_+- Added tests for GHC 8.4.4 through 8.6.1.+- Initial stable release.
README.pro view
@@ -4,6 +4,9 @@ #link[uri='https://ci.fldcr.com/prosidy/prosidy']{ #image[uri='https://ci.fldcr.com/api/badges/prosidy/prosidy/status.svg', desc='Build Status'] }+#link[uri='https://hackage.haskell.org/packages/prosidy']{+#image[uri='https://img.shields.io/hackage/v/prosidy', desc='Hackage']+} Prosidy is a small language for writing documents. @@ -31,7 +34,42 @@ That said, feedback is more than welcome! Reach me at #link[uri='mailto:alex@fldcr.com']{alex@fldcr.com}. -#-h{Developing Prosidy}-This project sets up an environment using direnv and Nix.-We'd recommend you have both installed before building,-although it may work without both.++#-h{Related projects}++#-h+{VSCode plugin}+#-list:+ #-item:+ homepage:+ #link[uri='https://marketplace.visualstudio.com/items?itemName=prosidy.prosidy']{+ marketplace.visualstudio.com/items?itemName=prosidy.prosidy+ }+ #:+ #-item:+ source: + #link[uri='https://git.fldcr.com/prosidy/vscode']{+ git.fldcr.com/prosidy/vscode+ }+ #:+#:+Official VSCode support for the Prosidy language.+++#-h+{#lit{prosidyc}}+#-list:+ #-item:+ homepage:+ #link[uri='https://hackage.haskell.org/packages/prosidyc']{+ hackage.haskell.org/packages/prosidyc+ }+ #:+ #-item:+ source: + #link[uri='https://git.fldcr.com/prosidy/prosidyc']{+ git.fldcr.com/prosidy/prosidyc+ }+ #:+#:+The #lit{prosidyc} Haskell library provides a small DSL for compiling+Prosidy documents into other formats, ensuring that source locations are+attached to error messages.
prosidy.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: prosidy-version: 1.6.0.0+version: 1.6.0.1 synopsis: A simple language for writing documents. license: MPL-2.0 license-file: LICENSE@@ -10,7 +10,7 @@ category: Language data-dir: data data-files: golden/**/*.pro, golden/**/*.json-extra-source-files: CHANGELOG, README.pro+extra-source-files: CHANGELOG.md, README.pro tested-with: GHC == 8.4.4
src/Prosidy/Types.hs view
@@ -30,6 +30,11 @@ , LiteralTag , tagToRegion , regionToTag+ -- * Regions+ , Region(..)+ , BlockRegion+ , InlineRegion+ , LiteralRegion -- * Contextual enumerations , Block(..) , Inline(..)@@ -37,7 +42,6 @@ , Paragraph(..) -- * Common structures , Metadata(..)- , Region(..) -- * Textual fragments , Fragment(..) -- * Utility wrappers@@ -315,13 +319,25 @@ -- Specified in Prosidy source with the @#-@ sigil. type BlockTag = Tag (Series Block) +-- | A 'Region' containing a zero or more 'Block' items. Like 'BlockTag',+-- without a tag name.+type BlockRegion = Region (Series Block)+ -- | A 'Tag' containing zero or more 'Inline' items. -- Specified in Prosidy source with the @#@ sigil. type InlineTag = Tag (Series Inline) +-- | A 'Region' containing a zero or more 'Inline' items. Like 'InlineTag',+-- without a tag name.+type InlineRegion = Region (Series Inline)+ -- | A 'Tag' containing a single plain-text item. -- Specified in Prosidy source with the @#=@ sigil. type LiteralTag = Tag Text++-- | A 'Region' containing a single plain-text item. Like 'LiteralTag', without+-- a tag name.+type LiteralRegion = Region Text -- | Convert a 'Tag' to a 'Region' by discarding the tag's name. tagToRegion :: Tag a -> Region a
src/Prosidy/Types/Series.hs view
@@ -7,6 +7,8 @@ -} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE PatternSynonyms #-}+{-# LANGUAGE ViewPatterns #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} module Prosidy.Types.Series ( -- * Possibly empty collections@@ -18,6 +20,13 @@ , SeriesNE , fromSeqNE , toSeqNE+ -- * Pattern synonyms for easy manipulation of series+ , pattern NonEmpty+ , pattern Empty+ , pattern (:>>:)+ , pattern (:<<:)+ , pattern (:>:)+ , pattern (:<:) ) where @@ -57,7 +66,7 @@ instance Traversable Series where traverse f (Series xs) = Series <$> traverse f xs --- | A non-empty 'Series'. +-- | A non-empty 'Series'. newtype SeriesNE a = SeriesNE (Seq a) deriving stock (Generic, Show) deriving newtype (Eq, Foldable, Functor, Applicative, ToJSON, NFData, Semigroup)@@ -84,6 +93,50 @@ instance Traversable SeriesNE where traverse f (SeriesNE xs) = SeriesNE <$> traverse f xs++pattern FromSeries :: Series a -> Seq a+pattern FromSeries a <- (fromSeq -> a)++-- | Matches against an empty 'Series'.+pattern Empty :: Series a+pattern Empty = Series Seq.Empty++-- | Matches a non-empty 'SeriesNE' as if it were just a 'Series'.+pattern NonEmpty :: SeriesNE a -> Series a+pattern NonEmpty a <- (seriesNE -> Just a)+ where NonEmpty (SeriesNE a) = Series a++-- | Match against the first element of a 'Series'.+infixr 5 :<:+pattern (:<:) :: a -> Series a -> Series a+pattern a :<: b <- Series (a Seq.:<| FromSeries b)+ where a :<: Series b = Series (a Seq.:<| b)++-- | Match against the last element of a 'Series'.+infixl 5 :>:+pattern (:>:) :: Series a -> a -> Series a+pattern a :>: b <- Series (FromSeries a Seq.:|> b)+ where Series a :>: b = Series (a Seq.:|> b)++-- | Match against a non-empty 'SeriesNE' and a leading element.+infixr 3 :<<:+pattern (:<<:) :: a -> Series a -> SeriesNE a+pattern a :<<: b <- SeriesNE (a Seq.:<| FromSeries b)+ where a :<<: Series b = SeriesNE (a Seq.:<| b)++-- | Match against a non-empty 'SeriesNE' and a trailing element.+infixl 3 :>>:+pattern (:>>:) :: Series a -> a -> SeriesNE a+pattern a :>>: b <- SeriesNE (FromSeries a Seq.:|> b)+ where Series a :>>: b = SeriesNE (a Seq.:|> b)++seriesNE :: Series a -> Maybe (SeriesNE a)+seriesNE = fromSeqNE . toSeq++{-# COMPLETE (:<<:) #-}+{-# COMPLETE (:>>:) #-}+{-# COMPLETE (:>:), Empty #-}+{-# COMPLETE (:<:), Empty #-} -- | Given a function which operates on a 'Seq', return a function which -- operates on a 'Series'.