module Text.Mustache.Types
(
ASTree
, STree
, Node(..)
, DataIdentifier(..)
, Template(..)
, TemplateCache
, Value(..)
, Key
, object
, (~>), (↝), (~=), (⥱)
, ToMustache, toMustache, mFromJSON, integralToMustache
, Array, Object, Pair
, SubM, askContext, askPartials
, Context(..)
) where
import Control.Monad.Reader
import qualified Data.Aeson as Aeson
import qualified Data.HashMap.Strict as HM
import Data.Text (Text)
import Text.Mustache.Internal.Types
object :: [Pair] -> Value
object :: [Pair] -> Value
object = Object -> Value
Object forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k v. (Eq k, Hashable k) => [(k, v)] -> HashMap k v
HM.fromList
(~>) :: ToMustache ω => Text -> ω -> Pair
~> :: forall ω. ToMustache ω => Text -> ω -> Pair
(~>) Text
t = (Text
t, ) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall ω. ToMustache ω => ω -> Value
toMustache
{-# INLINEABLE (~>) #-}
infixr 8 ~>
(↝) :: ToMustache ω => Text -> ω -> Pair
↝ :: forall ω. ToMustache ω => Text -> ω -> Pair
(↝) = forall ω. ToMustache ω => Text -> ω -> Pair
(~>)
{-# INLINEABLE (↝) #-}
infixr 8 ↝
(~=) :: Aeson.ToJSON ι => Text -> ι -> Pair
~= :: forall ι. ToJSON ι => Text -> ι -> Pair
(~=) Text
t = (Text
t forall ω. ToMustache ω => Text -> ω -> Pair
~>) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ToJSON a => a -> Value
Aeson.toJSON
{-# INLINEABLE (~=) #-}
infixr 8 ~=
(⥱) :: Aeson.ToJSON ι => Text -> ι -> Pair
⥱ :: forall ι. ToJSON ι => Text -> ι -> Pair
(⥱) = forall ι. ToJSON ι => Text -> ι -> Pair
(~=)
{-# INLINEABLE (⥱) #-}
infixr 8 ⥱
mFromJSON :: Aeson.ToJSON ι => ι -> Value
mFromJSON :: forall ι. ToJSON ι => ι -> Value
mFromJSON = forall ω. ToMustache ω => ω -> Value
toMustache forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ToJSON a => a -> Value
Aeson.toJSON
askContext :: SubM (Context Value)
askContext :: SubM (Context Value)
askContext = forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks forall a b. (a, b) -> a
fst
askPartials :: SubM TemplateCache
askPartials :: SubM TemplateCache
askPartials = forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks forall a b. (a, b) -> b
snd