module Language.PureScript.Label (Label(..)) where

import Prelude
import GHC.Generics (Generic)
import Codec.Serialise (Serialise)
import Control.DeepSeq (NFData)
import Data.Monoid ()
import Data.String (IsString(..))
import Data.Aeson qualified as A

import Language.PureScript.PSString (PSString)

-- |
-- Labels are used as record keys and row entry names. Labels newtype PSString
-- because records are indexable by PureScript strings at runtime.
--
newtype Label = Label { Label -> PSString
runLabel :: PSString }
  deriving (Int -> Label -> ShowS
[Label] -> ShowS
Label -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Label] -> ShowS
$cshowList :: [Label] -> ShowS
show :: Label -> String
$cshow :: Label -> String
showsPrec :: Int -> Label -> ShowS
$cshowsPrec :: Int -> Label -> ShowS
Show, Label -> Label -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Label -> Label -> Bool
$c/= :: Label -> Label -> Bool
== :: Label -> Label -> Bool
$c== :: Label -> Label -> Bool
Eq, Eq Label
Label -> Label -> Bool
Label -> Label -> Ordering
Label -> Label -> Label
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 :: Label -> Label -> Label
$cmin :: Label -> Label -> Label
max :: Label -> Label -> Label
$cmax :: Label -> Label -> Label
>= :: Label -> Label -> Bool
$c>= :: Label -> Label -> Bool
> :: Label -> Label -> Bool
$c> :: Label -> Label -> Bool
<= :: Label -> Label -> Bool
$c<= :: Label -> Label -> Bool
< :: Label -> Label -> Bool
$c< :: Label -> Label -> Bool
compare :: Label -> Label -> Ordering
$ccompare :: Label -> Label -> Ordering
Ord, String -> Label
forall a. (String -> a) -> IsString a
fromString :: String -> Label
$cfromString :: String -> Label
IsString, NonEmpty Label -> Label
Label -> Label -> Label
forall b. Integral b => b -> Label -> Label
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
stimes :: forall b. Integral b => b -> Label -> Label
$cstimes :: forall b. Integral b => b -> Label -> Label
sconcat :: NonEmpty Label -> Label
$csconcat :: NonEmpty Label -> Label
<> :: Label -> Label -> Label
$c<> :: Label -> Label -> Label
Semigroup, Semigroup Label
Label
[Label] -> Label
Label -> Label -> Label
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
mconcat :: [Label] -> Label
$cmconcat :: [Label] -> Label
mappend :: Label -> Label -> Label
$cmappend :: Label -> Label -> Label
mempty :: Label
$cmempty :: Label
Monoid, [Label] -> Encoding
[Label] -> Value
Label -> Encoding
Label -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [Label] -> Encoding
$ctoEncodingList :: [Label] -> Encoding
toJSONList :: [Label] -> Value
$ctoJSONList :: [Label] -> Value
toEncoding :: Label -> Encoding
$ctoEncoding :: Label -> Encoding
toJSON :: Label -> Value
$ctoJSON :: Label -> Value
A.ToJSON, Value -> Parser [Label]
Value -> Parser Label
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [Label]
$cparseJSONList :: Value -> Parser [Label]
parseJSON :: Value -> Parser Label
$cparseJSON :: Value -> Parser Label
A.FromJSON, forall x. Rep Label x -> Label
forall x. Label -> Rep Label x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Label x -> Label
$cfrom :: forall x. Label -> Rep Label x
Generic)

instance NFData Label
instance Serialise Label