module Ribosome.PluginName where
import Exon (exon)
import Ribosome.Data.PluginName (PluginName (PluginName))
import Ribosome.Host.Text (pascalCase)
pluginName ::
Member (Reader PluginName) r =>
Sem r PluginName
pluginName :: forall (r :: EffectRow).
Member (Reader PluginName) r =>
Sem r PluginName
pluginName =
Sem r PluginName
forall i (r :: EffectRow). Member (Reader i) r => Sem r i
ask
pluginNamePrefixed ::
Member (Reader PluginName) r =>
Text ->
Sem r Text
pluginNamePrefixed :: forall (r :: EffectRow).
Member (Reader PluginName) r =>
Text -> Sem r Text
pluginNamePrefixed Text
msg = do
PluginName Text
name <- Sem r PluginName
forall (r :: EffectRow).
Member (Reader PluginName) r =>
Sem r PluginName
pluginName
Text -> Sem r Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure [exon|#{name}: #{msg}|]
pluginNamePascalCase ::
Member (Reader PluginName) r =>
Sem r PluginName
pluginNamePascalCase :: forall (r :: EffectRow).
Member (Reader PluginName) r =>
Sem r PluginName
pluginNamePascalCase = do
PluginName Text
n <- Sem r PluginName
forall (r :: EffectRow).
Member (Reader PluginName) r =>
Sem r PluginName
pluginName
PluginName -> Sem r PluginName
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Text -> PluginName
PluginName (Text -> Text
forall a b. (ToString a, IsString b) => a -> b
pascalCase Text
n))