tomland-1.3.3.3: Bidirectional TOML serialization
Copyright(c) 2018-2022 Kowainik
LicenseMPL-2.0
MaintainerKowainik <xrom.xkov@gmail.com>
StabilityStable
PortabilityPortable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Toml.Type.Key

Description

Implementation of key type. The type is used for key-value pairs and table names.

Since: 1.3.0.0

Synopsis

Core types

newtype Key Source #

Key of value in key = val pair. Represents as non-empty list of key components — Pieces. Key like

site."google.com"

is represented like

Key (Piece "site" :| [Piece "\"google.com\""])

Since: 0.0.0

Constructors

Key 

Fields

Instances

Instances details
IsString Key Source #

Split a dot-separated string into Key. Empty string turns into a Key with single element — empty Piece.

This instance is not safe for now. Use carefully. If you try to use as a key string like this site."google.com" you will have list of three components instead of desired two.

Since: 0.1.0

Instance details

Defined in Toml.Type.Key

Methods

fromString :: String -> Key #

Semigroup Key Source # 
Instance details

Defined in Toml.Type.Key

Methods

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

sconcat :: NonEmpty Key -> Key #

stimes :: Integral b => b -> Key -> Key #

Generic Key Source # 
Instance details

Defined in Toml.Type.Key

Associated Types

type Rep Key :: Type -> Type #

Methods

from :: Key -> Rep Key x #

to :: Rep Key x -> Key #

Show Key Source # 
Instance details

Defined in Toml.Type.Key

Methods

showsPrec :: Int -> Key -> ShowS #

show :: Key -> String #

showList :: [Key] -> ShowS #

NFData Key Source # 
Instance details

Defined in Toml.Type.Key

Methods

rnf :: Key -> () #

Eq Key Source # 
Instance details

Defined in Toml.Type.Key

Methods

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

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

Ord Key Source # 
Instance details

Defined in Toml.Type.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 #

Hashable Key Source # 
Instance details

Defined in Toml.Type.Key

Methods

hashWithSalt :: Int -> Key -> Int #

hash :: Key -> Int #

type Rep Key Source # 
Instance details

Defined in Toml.Type.Key

type Rep Key = D1 ('MetaData "Key" "Toml.Type.Key" "tomland-1.3.3.3-Ih5ryp7Jmpp9EbGekxhWoS" 'True) (C1 ('MetaCons "Key" 'PrefixI 'True) (S1 ('MetaSel ('Just "unKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NonEmpty Piece))))

type Prefix = Key Source #

Type synonym for Key.

Since: 0.0.0

newtype Piece Source #

Represents the key piece of some layer.

Since: 0.0.0

Constructors

Piece 

Fields

Instances

Instances details
IsString Piece Source # 
Instance details

Defined in Toml.Type.Key

Methods

fromString :: String -> Piece #

Generic Piece Source # 
Instance details

Defined in Toml.Type.Key

Associated Types

type Rep Piece :: Type -> Type #

Methods

from :: Piece -> Rep Piece x #

to :: Rep Piece x -> Piece #

Show Piece Source # 
Instance details

Defined in Toml.Type.Key

Methods

showsPrec :: Int -> Piece -> ShowS #

show :: Piece -> String #

showList :: [Piece] -> ShowS #

NFData Piece Source # 
Instance details

Defined in Toml.Type.Key

Methods

rnf :: Piece -> () #

Eq Piece Source # 
Instance details

Defined in Toml.Type.Key

Methods

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

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

Ord Piece Source # 
Instance details

Defined in Toml.Type.Key

Methods

compare :: Piece -> Piece -> Ordering #

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

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

(>) :: Piece -> Piece -> Bool #

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

max :: Piece -> Piece -> Piece #

min :: Piece -> Piece -> Piece #

Hashable Piece Source # 
Instance details

Defined in Toml.Type.Key

Methods

hashWithSalt :: Int -> Piece -> Int #

hash :: Piece -> Int #

type Rep Piece Source # 
Instance details

Defined in Toml.Type.Key

type Rep Piece = D1 ('MetaData "Piece" "Toml.Type.Key" "tomland-1.3.3.3-Ih5ryp7Jmpp9EbGekxhWoS" 'True) (C1 ('MetaCons "Piece" 'PrefixI 'True) (S1 ('MetaSel ('Just "unPiece") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

pattern (:||) :: Piece -> [Piece] -> Key Source #

Bidirectional pattern synonym for constructing and deconstructing Keys.

(<|) :: Piece -> Key -> Key Source #

Prepends Piece to the beginning of the Key.

Key difference

data KeysDiff Source #

Data represent difference between two keys.

Since: 0.0.0

Constructors

Equal

Keys are equal

NoPrefix

Keys don't have any common part.

FstIsPref

The first key is the prefix of the second one.

Fields

  • !Key

    Rest of the second key.

SndIsPref

The second key is the prefix of the first one.

Fields

  • !Key

    Rest of the first key.

Diff

Key have a common prefix.

Fields

  • !Key

    Common prefix.

  • !Key

    Rest of the first key.

  • !Key

    Rest of the second key.

Instances

Instances details
Show KeysDiff Source # 
Instance details

Defined in Toml.Type.Key

Eq KeysDiff Source # 
Instance details

Defined in Toml.Type.Key

keysDiff :: Key -> Key -> KeysDiff Source #

Find key difference between two keys.

Since: 0.0.0