language-ninja-0.2.0: A library for dealing with the Ninja build language.

CopyrightCopyright 2017 Awake Security
LicenseApache-2.0
Maintaineropensource@awakesecurity.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Language.Ninja.Misc.IText

Description

An interned text type.

Since: 0.1.0

Synopsis

Documentation

data IText Source #

An interned (hash-consed) text type. This is a newtype over InternedText from the intern package.

Since: 0.1.0

Instances

Eq IText Source # 

Methods

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

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

Ord IText Source #

The Ord instance in intern compares hashes rather than values.

Since: 0.1.0

Methods

compare :: IText -> IText -> Ordering #

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

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

(>) :: IText -> IText -> Bool #

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

max :: IText -> IText -> IText #

min :: IText -> IText -> IText #

Read IText Source #

Inverse of the Show instance.

Since: 0.1.0

Show IText Source #

Displays an IText such that fromString is inverse to show.

Since: 0.1.0

Methods

showsPrec :: Int -> IText -> ShowS #

show :: IText -> String #

showList :: [IText] -> ShowS #

IsString IText Source # 

Methods

fromString :: String -> IText #

Generic IText Source # 

Associated Types

type Rep IText :: * -> * #

Methods

from :: IText -> Rep IText x #

to :: Rep IText x -> IText #

Hashable IText Source #

Uses the Hashable instance for Text. Not very efficient.

TODO: perhaps switch to hashing the identifier, since this is likely pretty hot code given all the HashMap Target … types all over the place.

Since: 0.1.0

Methods

hashWithSalt :: Int -> IText -> Int #

hash :: IText -> Int #

ToJSON IText Source #

Converts to JSON string via uninternText.

Since: 0.1.0

ToJSONKey IText Source #

Converts to JSON string via uninternText.

Since: 0.1.0

FromJSON IText Source #

Inverse of the ToJSON instance.

Since: 0.1.0

FromJSONKey IText Source #

Inverse of the ToJSONKey instance.

Since: 0.1.0

NFData IText Source #

Defined by rnf a = seq a (), since IText is a newtype of strict types.

Since: 0.1.0

Methods

rnf :: IText -> () #

(Monad m, Serial m Text) => Serial m IText Source #

Uses the Text instance.

Since: 0.1.0

Methods

series :: Series m IText #

(Monad m, CoSerial m Text) => CoSerial m IText Source #

Uses the Text instance.

Since: 0.1.0

Methods

coseries :: Series m b -> Series m (IText -> b) #

type Rep IText Source # 
type Rep IText = D1 (MetaData "IText" "Language.Ninja.Misc.IText" "language-ninja-0.2.0-4aVVODOvkNMFxGcRpnztag" True) (C1 (MetaCons "MkIText" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 InternedText)))

uninternText :: IText -> Text Source #

Get the Text corresponding to the given IText value.

>>> uninternText ("foobar" :: IText)
"foobar"

Since: 0.1.0

internText :: Text -> IText Source #

Intern a Text value, resulting in an IText value.

uninternText (internText (Text.pack x)) == Text.pack x
>>> internText ("foobar" :: Text)
"foobar"

Since: 0.1.0

itext :: Iso' Text IText Source #

An Iso' between Text and IText.

(Lens.view itext (fromString x)) == fromString x
(Lens.view (Lens.from itext) (fromString x)) == fromString x
>>> (Lens.view itext ("foobar" :: Text)) :: IText
"foobar"
>>> (Lens.view (Lens.from itext) ("foobar" :: IText)) :: Text
"foobar"

Since: 0.1.0