|
10 | 10 |
|
11 | 11 | #include "version-compatibility-macros.h" |
12 | 12 |
|
| 13 | +#if BIDI_PATTERN_SYNONYMS |
| 14 | +{-# LANGUAGE PatternSynonyms #-} |
| 15 | +{-# LANGUAGE ViewPatterns #-} |
| 16 | +#if PATTERN_SYNONYM_SIGNATURES |
| 17 | +{-# OPTIONS_GHC -fno-warn-missing-pattern-synonym-signatures #-} |
| 18 | +#endif |
| 19 | +#endif |
| 20 | + |
13 | 21 | -- | __Warning: internal module!__ This means that the API may change |
14 | 22 | -- arbitrarily between versions without notice. Depending on this module may |
15 | 23 | -- lead to unexpected breakages, so proceed with caution! |
@@ -68,6 +76,9 @@ module Prettyprinter.Internal ( |
68 | 76 |
|
69 | 77 | -- * Layout |
70 | 78 | SimpleDocStream(..), |
| 79 | +#if BIDI_PATTERN_SYNONYMS |
| 80 | + pattern SString, |
| 81 | +#endif |
71 | 82 | PageWidth(..), defaultPageWidth, |
72 | 83 | LayoutOptions(..), defaultLayoutOptions, |
73 | 84 | layoutPretty, layoutCompact, layoutSmart, |
@@ -1596,6 +1607,23 @@ data SimpleDocStream ann = |
1596 | 1607 | | SAnnPop (SimpleDocStream ann) |
1597 | 1608 | deriving (Eq, Ord, Show, Generic, Typeable) |
1598 | 1609 |
|
| 1610 | +#if BIDI_PATTERN_SYNONYMS |
| 1611 | + |
| 1612 | +#ifdef MIN_VERSION_text |
| 1613 | +-- | 'length' is /O(n)/, so we cache it in the 'Int' field. |
| 1614 | +pattern SString a b c <- SText a (T.unpack -> b) c where |
| 1615 | + SString a b c = SText a (T.pack b) c |
| 1616 | +#else |
| 1617 | +-- | 'length' is /O(n)/, so we cache it in the 'Int' field. |
| 1618 | +pattern SString a b c = SText a b c |
| 1619 | +#endif |
| 1620 | + |
| 1621 | +#if COMPLETE_PRAGMA |
| 1622 | +{-# COMPLETE SFail, SEmpty, SChar, SString, SLine, SAnnPush, SAnnPop #-} |
| 1623 | +#endif |
| 1624 | + |
| 1625 | +#endif |
| 1626 | + |
1599 | 1627 | -- | Remove all trailing space characters. |
1600 | 1628 | -- |
1601 | 1629 | -- This has some performance impact, because it does an entire additional pass |
|
0 commit comments