-- |Special command parameter that exposes the used register.
module Ribosome.Host.Data.CommandRegister where

import Ribosome.Host.Class.Msgpack.Decode (MsgpackDecode)

-- |When this type is used as a parameter of a command handler function, the RPC trigger uses the special token
-- @<reg>@ in the call.
--
-- This type then contains the name of the register specified by the user.
newtype CommandRegister =
  CommandRegister { CommandRegister -> Text
unCommandRegister :: Text }
  deriving stock (CommandRegister -> CommandRegister -> Bool
(CommandRegister -> CommandRegister -> Bool)
-> (CommandRegister -> CommandRegister -> Bool)
-> Eq CommandRegister
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CommandRegister -> CommandRegister -> Bool
$c/= :: CommandRegister -> CommandRegister -> Bool
== :: CommandRegister -> CommandRegister -> Bool
$c== :: CommandRegister -> CommandRegister -> Bool
Eq, Int -> CommandRegister -> ShowS
[CommandRegister] -> ShowS
CommandRegister -> String
(Int -> CommandRegister -> ShowS)
-> (CommandRegister -> String)
-> ([CommandRegister] -> ShowS)
-> Show CommandRegister
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CommandRegister] -> ShowS
$cshowList :: [CommandRegister] -> ShowS
show :: CommandRegister -> String
$cshow :: CommandRegister -> String
showsPrec :: Int -> CommandRegister -> ShowS
$cshowsPrec :: Int -> CommandRegister -> ShowS
Show)
  deriving newtype (String -> CommandRegister
(String -> CommandRegister) -> IsString CommandRegister
forall a. (String -> a) -> IsString a
fromString :: String -> CommandRegister
$cfromString :: String -> CommandRegister
IsString, Eq CommandRegister
Eq CommandRegister
-> (CommandRegister -> CommandRegister -> Ordering)
-> (CommandRegister -> CommandRegister -> Bool)
-> (CommandRegister -> CommandRegister -> Bool)
-> (CommandRegister -> CommandRegister -> Bool)
-> (CommandRegister -> CommandRegister -> Bool)
-> (CommandRegister -> CommandRegister -> CommandRegister)
-> (CommandRegister -> CommandRegister -> CommandRegister)
-> Ord CommandRegister
CommandRegister -> CommandRegister -> Bool
CommandRegister -> CommandRegister -> Ordering
CommandRegister -> CommandRegister -> CommandRegister
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: CommandRegister -> CommandRegister -> CommandRegister
$cmin :: CommandRegister -> CommandRegister -> CommandRegister
max :: CommandRegister -> CommandRegister -> CommandRegister
$cmax :: CommandRegister -> CommandRegister -> CommandRegister
>= :: CommandRegister -> CommandRegister -> Bool
$c>= :: CommandRegister -> CommandRegister -> Bool
> :: CommandRegister -> CommandRegister -> Bool
$c> :: CommandRegister -> CommandRegister -> Bool
<= :: CommandRegister -> CommandRegister -> Bool
$c<= :: CommandRegister -> CommandRegister -> Bool
< :: CommandRegister -> CommandRegister -> Bool
$c< :: CommandRegister -> CommandRegister -> Bool
compare :: CommandRegister -> CommandRegister -> Ordering
$ccompare :: CommandRegister -> CommandRegister -> Ordering
Ord, String -> Object -> Either Text CommandRegister
Object -> Either Text CommandRegister
(Object -> Either Text CommandRegister)
-> (String -> Object -> Either Text CommandRegister)
-> MsgpackDecode CommandRegister
forall a.
(Object -> Either Text a)
-> (String -> Object -> Either Text a) -> MsgpackDecode a
missingKey :: String -> Object -> Either Text CommandRegister
$cmissingKey :: String -> Object -> Either Text CommandRegister
fromMsgpack :: Object -> Either Text CommandRegister
$cfromMsgpack :: Object -> Either Text CommandRegister
MsgpackDecode)