{-# LANGUAGE DerivingVia #-}
module Text.Interpolation.Nyan.Core.Internal.Base where
import Data.Monoid (Endo (..))
import Data.Text (Text)
import Language.Haskell.TH (ExpQ)
data IntData = IntData
{ IntData -> Text
idMode :: Text
, IntData -> Text
idCode :: Text
} deriving stock (Int -> IntData -> ShowS
[IntData] -> ShowS
IntData -> String
(Int -> IntData -> ShowS)
-> (IntData -> String) -> ([IntData] -> ShowS) -> Show IntData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IntData] -> ShowS
$cshowList :: [IntData] -> ShowS
show :: IntData -> String
$cshow :: IntData -> String
showsPrec :: Int -> IntData -> ShowS
$cshowsPrec :: Int -> IntData -> ShowS
Show, IntData -> IntData -> Bool
(IntData -> IntData -> Bool)
-> (IntData -> IntData -> Bool) -> Eq IntData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IntData -> IntData -> Bool
$c/= :: IntData -> IntData -> Bool
== :: IntData -> IntData -> Bool
$c== :: IntData -> IntData -> Bool
Eq)
data ParsedIntPiece
= PipString Text
| PipNewline Text
| PipLeadingWs Word
| PipEmptyLine
| PipInt IntData
deriving stock (Int -> ParsedIntPiece -> ShowS
[ParsedIntPiece] -> ShowS
ParsedIntPiece -> String
(Int -> ParsedIntPiece -> ShowS)
-> (ParsedIntPiece -> String)
-> ([ParsedIntPiece] -> ShowS)
-> Show ParsedIntPiece
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParsedIntPiece] -> ShowS
$cshowList :: [ParsedIntPiece] -> ShowS
show :: ParsedIntPiece -> String
$cshow :: ParsedIntPiece -> String
showsPrec :: Int -> ParsedIntPiece -> ShowS
$cshowsPrec :: Int -> ParsedIntPiece -> ShowS
Show, ParsedIntPiece -> ParsedIntPiece -> Bool
(ParsedIntPiece -> ParsedIntPiece -> Bool)
-> (ParsedIntPiece -> ParsedIntPiece -> Bool) -> Eq ParsedIntPiece
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParsedIntPiece -> ParsedIntPiece -> Bool
$c/= :: ParsedIntPiece -> ParsedIntPiece -> Bool
== :: ParsedIntPiece -> ParsedIntPiece -> Bool
$c== :: ParsedIntPiece -> ParsedIntPiece -> Bool
Eq)
type ParsedInterpolatedString = [ParsedIntPiece]
data IntPiece
= IpString Text
| IpInt IntData
deriving stock (Int -> IntPiece -> ShowS
[IntPiece] -> ShowS
IntPiece -> String
(Int -> IntPiece -> ShowS)
-> (IntPiece -> String) -> ([IntPiece] -> ShowS) -> Show IntPiece
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IntPiece] -> ShowS
$cshowList :: [IntPiece] -> ShowS
show :: IntPiece -> String
$cshow :: IntPiece -> String
showsPrec :: Int -> IntPiece -> ShowS
$cshowsPrec :: Int -> IntPiece -> ShowS
Show, IntPiece -> IntPiece -> Bool
(IntPiece -> IntPiece -> Bool)
-> (IntPiece -> IntPiece -> Bool) -> Eq IntPiece
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IntPiece -> IntPiece -> Bool
$c/= :: IntPiece -> IntPiece -> Bool
== :: IntPiece -> IntPiece -> Bool
$c== :: IntPiece -> IntPiece -> Bool
Eq)
type InterpolatedString = [IntPiece]
data ReturnType
= AnyFromBuilder
| ConcreteText
| ConcreteLText
| ConcreteBuilder
deriving stock (Int -> ReturnType -> ShowS
[ReturnType] -> ShowS
ReturnType -> String
(Int -> ReturnType -> ShowS)
-> (ReturnType -> String)
-> ([ReturnType] -> ShowS)
-> Show ReturnType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReturnType] -> ShowS
$cshowList :: [ReturnType] -> ShowS
show :: ReturnType -> String
$cshow :: ReturnType -> String
showsPrec :: Int -> ReturnType -> ShowS
$cshowsPrec :: Int -> ReturnType -> ShowS
Show, ReturnType -> ReturnType -> Bool
(ReturnType -> ReturnType -> Bool)
-> (ReturnType -> ReturnType -> Bool) -> Eq ReturnType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReturnType -> ReturnType -> Bool
$c/= :: ReturnType -> ReturnType -> Bool
== :: ReturnType -> ReturnType -> Bool
$c== :: ReturnType -> ReturnType -> Bool
Eq)
data PreviewLevel
= PreviewNone
| PreviewExact
| PreviewInvisible
deriving stock (Int -> PreviewLevel -> ShowS
[PreviewLevel] -> ShowS
PreviewLevel -> String
(Int -> PreviewLevel -> ShowS)
-> (PreviewLevel -> String)
-> ([PreviewLevel] -> ShowS)
-> Show PreviewLevel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PreviewLevel] -> ShowS
$cshowList :: [PreviewLevel] -> ShowS
show :: PreviewLevel -> String
$cshow :: PreviewLevel -> String
showsPrec :: Int -> PreviewLevel -> ShowS
$cshowsPrec :: Int -> PreviewLevel -> ShowS
Show, PreviewLevel -> PreviewLevel -> Bool
(PreviewLevel -> PreviewLevel -> Bool)
-> (PreviewLevel -> PreviewLevel -> Bool) -> Eq PreviewLevel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PreviewLevel -> PreviewLevel -> Bool
$c/= :: PreviewLevel -> PreviewLevel -> Bool
== :: PreviewLevel -> PreviewLevel -> Bool
$c== :: PreviewLevel -> PreviewLevel -> Bool
Eq, Int -> PreviewLevel
PreviewLevel -> Int
PreviewLevel -> [PreviewLevel]
PreviewLevel -> PreviewLevel
PreviewLevel -> PreviewLevel -> [PreviewLevel]
PreviewLevel -> PreviewLevel -> PreviewLevel -> [PreviewLevel]
(PreviewLevel -> PreviewLevel)
-> (PreviewLevel -> PreviewLevel)
-> (Int -> PreviewLevel)
-> (PreviewLevel -> Int)
-> (PreviewLevel -> [PreviewLevel])
-> (PreviewLevel -> PreviewLevel -> [PreviewLevel])
-> (PreviewLevel -> PreviewLevel -> [PreviewLevel])
-> (PreviewLevel -> PreviewLevel -> PreviewLevel -> [PreviewLevel])
-> Enum PreviewLevel
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: PreviewLevel -> PreviewLevel -> PreviewLevel -> [PreviewLevel]
$cenumFromThenTo :: PreviewLevel -> PreviewLevel -> PreviewLevel -> [PreviewLevel]
enumFromTo :: PreviewLevel -> PreviewLevel -> [PreviewLevel]
$cenumFromTo :: PreviewLevel -> PreviewLevel -> [PreviewLevel]
enumFromThen :: PreviewLevel -> PreviewLevel -> [PreviewLevel]
$cenumFromThen :: PreviewLevel -> PreviewLevel -> [PreviewLevel]
enumFrom :: PreviewLevel -> [PreviewLevel]
$cenumFrom :: PreviewLevel -> [PreviewLevel]
fromEnum :: PreviewLevel -> Int
$cfromEnum :: PreviewLevel -> Int
toEnum :: Int -> PreviewLevel
$ctoEnum :: Int -> PreviewLevel
pred :: PreviewLevel -> PreviewLevel
$cpred :: PreviewLevel -> PreviewLevel
succ :: PreviewLevel -> PreviewLevel
$csucc :: PreviewLevel -> PreviewLevel
Enum, PreviewLevel
PreviewLevel -> PreviewLevel -> Bounded PreviewLevel
forall a. a -> a -> Bounded a
maxBound :: PreviewLevel
$cmaxBound :: PreviewLevel
minBound :: PreviewLevel
$cminBound :: PreviewLevel
Bounded)
data SwitchesOptions = SwitchesOptions
{ SwitchesOptions -> Bool
spacesTrimming :: Bool
, SwitchesOptions -> Bool
indentationStripping :: Bool
, SwitchesOptions -> Bool
leadingNewlineStripping :: Bool
, SwitchesOptions -> Bool
trailingSpacesStripping :: Bool
, SwitchesOptions -> ReturnType
returnType :: ReturnType
, SwitchesOptions -> Bool
reducedNewlines :: Bool
, SwitchesOptions -> Bool
monadic :: Bool
, SwitchesOptions -> PreviewLevel
previewLevel :: PreviewLevel
} deriving stock (Int -> SwitchesOptions -> ShowS
[SwitchesOptions] -> ShowS
SwitchesOptions -> String
(Int -> SwitchesOptions -> ShowS)
-> (SwitchesOptions -> String)
-> ([SwitchesOptions] -> ShowS)
-> Show SwitchesOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SwitchesOptions] -> ShowS
$cshowList :: [SwitchesOptions] -> ShowS
show :: SwitchesOptions -> String
$cshow :: SwitchesOptions -> String
showsPrec :: Int -> SwitchesOptions -> ShowS
$cshowsPrec :: Int -> SwitchesOptions -> ShowS
Show, SwitchesOptions -> SwitchesOptions -> Bool
(SwitchesOptions -> SwitchesOptions -> Bool)
-> (SwitchesOptions -> SwitchesOptions -> Bool)
-> Eq SwitchesOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SwitchesOptions -> SwitchesOptions -> Bool
$c/= :: SwitchesOptions -> SwitchesOptions -> Bool
== :: SwitchesOptions -> SwitchesOptions -> Bool
$c== :: SwitchesOptions -> SwitchesOptions -> Bool
Eq)
data DefaultSwitchesOptions = DefaultSwitchesOptions
{ DefaultSwitchesOptions -> Maybe Bool
defSpacesTrimming :: Maybe Bool
, DefaultSwitchesOptions -> Maybe Bool
defIndentationStripping :: Maybe Bool
, DefaultSwitchesOptions -> Maybe Bool
defLeadingNewlineStripping :: Maybe Bool
, DefaultSwitchesOptions -> Maybe Bool
defTrailingSpacesStripping :: Maybe Bool
, DefaultSwitchesOptions -> Maybe Bool
defReducedNewlines :: Maybe Bool
, DefaultSwitchesOptions -> Maybe ReturnType
defReturnType :: Maybe ReturnType
, DefaultSwitchesOptions -> Maybe Bool
defMonadic :: Maybe Bool
} deriving stock (Int -> DefaultSwitchesOptions -> ShowS
[DefaultSwitchesOptions] -> ShowS
DefaultSwitchesOptions -> String
(Int -> DefaultSwitchesOptions -> ShowS)
-> (DefaultSwitchesOptions -> String)
-> ([DefaultSwitchesOptions] -> ShowS)
-> Show DefaultSwitchesOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DefaultSwitchesOptions] -> ShowS
$cshowList :: [DefaultSwitchesOptions] -> ShowS
show :: DefaultSwitchesOptions -> String
$cshow :: DefaultSwitchesOptions -> String
showsPrec :: Int -> DefaultSwitchesOptions -> ShowS
$cshowsPrec :: Int -> DefaultSwitchesOptions -> ShowS
Show)
basicDefaultSwitchesOptions :: DefaultSwitchesOptions
basicDefaultSwitchesOptions :: DefaultSwitchesOptions
basicDefaultSwitchesOptions = DefaultSwitchesOptions :: Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe ReturnType
-> Maybe Bool
-> DefaultSwitchesOptions
DefaultSwitchesOptions
{ defSpacesTrimming :: Maybe Bool
defSpacesTrimming = Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
False
, defIndentationStripping :: Maybe Bool
defIndentationStripping = Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
False
, defLeadingNewlineStripping :: Maybe Bool
defLeadingNewlineStripping = Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
False
, defTrailingSpacesStripping :: Maybe Bool
defTrailingSpacesStripping = Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
False
, defReturnType :: Maybe ReturnType
defReturnType = ReturnType -> Maybe ReturnType
forall a. a -> Maybe a
Just ReturnType
AnyFromBuilder
, defReducedNewlines :: Maybe Bool
defReducedNewlines = Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
False
, defMonadic :: Maybe Bool
defMonadic = Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
False
}
recommendedDefaultSwitchesOptions :: DefaultSwitchesOptions
recommendedDefaultSwitchesOptions :: DefaultSwitchesOptions
recommendedDefaultSwitchesOptions = DefaultSwitchesOptions :: Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe ReturnType
-> Maybe Bool
-> DefaultSwitchesOptions
DefaultSwitchesOptions
{ defSpacesTrimming :: Maybe Bool
defSpacesTrimming = Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
False
, defIndentationStripping :: Maybe Bool
defIndentationStripping = Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True
, defLeadingNewlineStripping :: Maybe Bool
defLeadingNewlineStripping = Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True
, defTrailingSpacesStripping :: Maybe Bool
defTrailingSpacesStripping = Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True
, defReturnType :: Maybe ReturnType
defReturnType = ReturnType -> Maybe ReturnType
forall a. a -> Maybe a
Just ReturnType
AnyFromBuilder
, defReducedNewlines :: Maybe Bool
defReducedNewlines = Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
False
, defMonadic :: Maybe Bool
defMonadic = Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
False
}
newtype ValueInterpolator = ValueInterpolator
{ ValueInterpolator -> Text -> ExpQ
runValueInterpolator :: Text -> ExpQ
}
newtype InvisibleCharsPreview = InvisibleCharsPreview
{ InvisibleCharsPreview -> ShowS
replaceInvisibleChars :: String -> String
} deriving b -> InvisibleCharsPreview -> InvisibleCharsPreview
NonEmpty InvisibleCharsPreview -> InvisibleCharsPreview
InvisibleCharsPreview
-> InvisibleCharsPreview -> InvisibleCharsPreview
(InvisibleCharsPreview
-> InvisibleCharsPreview -> InvisibleCharsPreview)
-> (NonEmpty InvisibleCharsPreview -> InvisibleCharsPreview)
-> (forall b.
Integral b =>
b -> InvisibleCharsPreview -> InvisibleCharsPreview)
-> Semigroup InvisibleCharsPreview
forall b.
Integral b =>
b -> InvisibleCharsPreview -> InvisibleCharsPreview
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
stimes :: b -> InvisibleCharsPreview -> InvisibleCharsPreview
$cstimes :: forall b.
Integral b =>
b -> InvisibleCharsPreview -> InvisibleCharsPreview
sconcat :: NonEmpty InvisibleCharsPreview -> InvisibleCharsPreview
$csconcat :: NonEmpty InvisibleCharsPreview -> InvisibleCharsPreview
<> :: InvisibleCharsPreview
-> InvisibleCharsPreview -> InvisibleCharsPreview
$c<> :: InvisibleCharsPreview
-> InvisibleCharsPreview -> InvisibleCharsPreview
Semigroup via (Endo String)
deriving Semigroup InvisibleCharsPreview
InvisibleCharsPreview
Semigroup InvisibleCharsPreview
-> InvisibleCharsPreview
-> (InvisibleCharsPreview
-> InvisibleCharsPreview -> InvisibleCharsPreview)
-> ([InvisibleCharsPreview] -> InvisibleCharsPreview)
-> Monoid InvisibleCharsPreview
[InvisibleCharsPreview] -> InvisibleCharsPreview
InvisibleCharsPreview
-> InvisibleCharsPreview -> InvisibleCharsPreview
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
mconcat :: [InvisibleCharsPreview] -> InvisibleCharsPreview
$cmconcat :: [InvisibleCharsPreview] -> InvisibleCharsPreview
mappend :: InvisibleCharsPreview
-> InvisibleCharsPreview -> InvisibleCharsPreview
$cmappend :: InvisibleCharsPreview
-> InvisibleCharsPreview -> InvisibleCharsPreview
mempty :: InvisibleCharsPreview
$cmempty :: InvisibleCharsPreview
$cp1Monoid :: Semigroup InvisibleCharsPreview
Monoid via (Endo String)
data InterpolatorOptions = InterpolatorOptions
{ InterpolatorOptions -> DefaultSwitchesOptions
defaultSwitchesOptions :: DefaultSwitchesOptions
, InterpolatorOptions -> ValueInterpolator
valueInterpolator :: ValueInterpolator
, InterpolatorOptions -> InvisibleCharsPreview
invisibleCharsPreview :: InvisibleCharsPreview
}