prosidy-1.6.0.2: A simple language for writing documents.
Copyright©2020 James Alexander Feldman-Crough
LicenseMPL-2.0
Maintaineralex@fldcr.com
Safe HaskellSafe
LanguageHaskell2010

Prosidy.Types.Key

Description

 
Synopsis

The Key type.

data Key Source #

A Key is an identifier used in tags, properties, and setting names.

Instances

Instances details
Eq Key Source # 
Instance details

Defined in Prosidy.Types.Key

Methods

(==) :: Key -> Key -> Bool #

(/=) :: Key -> Key -> Bool #

Ord Key Source # 
Instance details

Defined in Prosidy.Types.Key

Methods

compare :: Key -> Key -> Ordering #

(<) :: Key -> Key -> Bool #

(<=) :: Key -> Key -> Bool #

(>) :: Key -> Key -> Bool #

(>=) :: Key -> Key -> Bool #

max :: Key -> Key -> Key #

min :: Key -> Key -> Key #

Show Key Source # 
Instance details

Defined in Prosidy.Types.Key

Methods

showsPrec :: Int -> Key -> ShowS #

show :: Key -> String #

showList :: [Key] -> ShowS #

IsString Key Source #

Key exposes an IsString instance, but beware! Invalid strings will throw a pure exception.

Instance details

Defined in Prosidy.Types.Key

Methods

fromString :: String -> Key #

Generic Key Source # 
Instance details

Defined in Prosidy.Types.Key

Associated Types

type Rep Key :: Type -> Type #

Methods

from :: Key -> Rep Key x #

to :: Rep Key x -> Key #

Hashable Key Source # 
Instance details

Defined in Prosidy.Types.Key

Methods

hashWithSalt :: Int -> Key -> Int #

hash :: Key -> Int #

ToJSON Key Source # 
Instance details

Defined in Prosidy.Types.Key

ToJSONKey Key Source # 
Instance details

Defined in Prosidy.Types.Key

FromJSON Key Source # 
Instance details

Defined in Prosidy.Types.Key

FromJSONKey Key Source # 
Instance details

Defined in Prosidy.Internal.JSON

Binary Key Source # 
Instance details

Defined in Prosidy.Types.Key

Methods

put :: Key -> Put #

get :: Get Key #

putList :: [Key] -> Put #

NFData Key Source # 
Instance details

Defined in Prosidy.Types.Key

Methods

rnf :: Key -> () #

Pretty Key Source # 
Instance details

Defined in Prosidy.Types.Key

Methods

pretty :: Key -> Doc ann #

prettyList :: [Key] -> Doc ann #

type Rep Key Source # 
Instance details

Defined in Prosidy.Types.Key

type Rep Key = D1 ('MetaData "Key" "Prosidy.Types.Key" "prosidy-1.6.0.2-inplace" 'True) (C1 ('MetaCons "Key" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

Creating Keys and unwrapping them

makeKey :: Text -> Either KeyError Key Source #

Create a new Key, checking its validity.

rawKey :: Key -> Text Source #

Convert a Key into its Text representation.

unsafeMakeKey :: Text -> Key Source #

Create a new Key without performing any checks.

Checking validity of raw text.

isValidKeyHead :: Char -> Bool Source #

Check if a character is suitable for use as the first character in a Key.

isValidKeyTail :: Char -> Bool Source #

Check if a character is suitable for use as any character except the first character in a Key.

Errors

data KeyError Source #

Errors returned when creating invalid keys.

Constructors

InvalidCharacterError InvalidCharacter

A character provided as a Key's name was invalid.

EmptyKeyError

A string of length 0 was provided as a Key's name.

Instances

Instances details
Eq KeyError Source # 
Instance details

Defined in Prosidy.Types.Key

Show KeyError Source # 
Instance details

Defined in Prosidy.Types.Key

Exception KeyError Source # 
Instance details

Defined in Prosidy.Types.Key

data InvalidCharacter Source #

Details for errors thrown when creating Keys with one or more invalid characters.

Constructors

InvalidCharacter 

Fields