exon 1.0.1.0 → 1.1.0.0
raw patch · 3 files changed
+24/−20 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Exon.Class.Exon: exonAppendResult :: forall result builder. ExonAppend result builder => Result builder -> Result builder -> Result builder
+ Exon: exonConcat :: ExonAppend result builder => NonEmpty (Result builder) -> Result builder
+ Exon.Class.Exon: exonConcat :: ExonAppend result builder => NonEmpty (Result builder) -> Result builder
Files
- changelog.md +5/−0
- exon.cabal +2/−2
- lib/Exon/Class/Exon.hs +17/−18
changelog.md view
@@ -1,3 +1,8 @@+# 1.1.0.0++* Add `exonConcat` to `ExonAppend`. The function is pulled out of `exonBuild` to allow using a different way of folding+ the segment list.+ # 1.0.0.0 * Rewrite the main logic, splitting it across multiple classes.
exon.cabal view
@@ -5,12 +5,12 @@ -- see: https://github.com/sol/hpack name: exon-version: 1.0.1.0+version: 1.1.0.0 synopsis: Customizable Quasiquote Interpolation description: See https://hackage.haskell.org/package/exon/docs/Exon.html category: String homepage: https://git.tryp.io/tek/exon-bug-reports: https://git.tryp.io/tek/exon/issues+bug-reports: https://github.com/tek/exon/issues author: Torsten Schmits maintainer: hackage@tryp.io copyright: 2022 Torsten Schmits
lib/Exon/Class/Exon.hs view
@@ -177,6 +177,22 @@ -- |Concatenate two segments of the builder type. exonAppend :: builder -> builder -> Result builder + -- |Concatenate a list of segments of the result type.+ --+ -- Folds the list over 'exonAppend', skipping over 'Empty' segments.+ --+ -- A possible overload may implement lookahead to skip whitespace.+ --+ -- @since 1.1.0.0+ exonConcat :: NonEmpty (Result builder) -> Result builder+ exonConcat =+ foldl1 \case+ Empty -> id+ Result z -> \case+ Empty -> Result z+ Result a -> exonAppend @result @builder z a+ {-# inline exonConcat #-}+ instance {-# overlappable #-} ( Semigroup builder ) => ExonAppend result builder where@@ -189,23 +205,6 @@ Result (z . a) {-# inline exonAppend #-} --- |Wrapper for 'exonAppend' that handles the 'Empty' case.------ @since 1.0.0.0-exonAppendResult ::- ∀ result builder .- ExonAppend result builder =>- Result builder ->- Result builder ->- Result builder-exonAppendResult (Result z) (Result a) =- exonAppend @result z a-exonAppendResult z Empty =- z-exonAppendResult Empty a =- a-{-# inline exonAppendResult #-}- -- |This class implements the 'Segment' concatenation logic. -- -- 1. Each 'Segment.Expression' is converted to the builder type by 'ExonBuilder'.@@ -227,7 +226,7 @@ ) => ExonBuild result inner where exonBuild = exonBuilderExtract .- foldl1 (exonAppendResult @result) .+ exonConcat @result . fmap (exonSegment @result . fmap exonBuilder) {-# inline exonBuild #-}