Browse Source

Added Region type synonyms (#13)

Added Region type synonyms

Co-authored-by: Alex Feldman-Crough <alex@fldcr.com>
Reviewed-on: #13
master
James Alexander Feldman-Crough 1 year ago
parent
commit
1170cb1f19
  1. 5
      CHANGELOG.md
  2. 4
      prosidy.cabal
  3. 18
      src/Prosidy/Types.hs

5
CHANGELOG → CHANGELOG.md

@ -1,3 +1,8 @@
# 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.

4
prosidy.cabal

@ -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 @@ copyright: ©2020 to James Alexander Feldman-Crough
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

18
src/Prosidy/Types.hs

@ -30,6 +30,11 @@ module Prosidy.Types
, LiteralTag
, tagToRegion
, regionToTag
-- * Regions
, Region(..)
, BlockRegion
, InlineRegion
, LiteralRegion
-- * Contextual enumerations
, Block(..)
, Inline(..)
@ -37,7 +42,6 @@ module Prosidy.Types
, Paragraph(..)
-- * Common structures
, Metadata(..)
, Region(..)
-- * Textual fragments
, Fragment(..)
-- * Utility wrappers
@ -315,14 +319,26 @@ instance ToJSON a => ToJSON (Tag a) where
-- 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
tagToRegion (Tag _ md ct loc) = Region md ct loc

Loading…
Cancel
Save