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.IText0.1.0

Description

An interned text type.

Synopsis

Documentation

data IText Source 0.1.0#

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

Instances

Eq IText  

Methods

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

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

Ord IText

The Ord instance in intern compares hashes rather than values.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

Inverse of the Show instance.0.1.0

Show IText

Displays an IText such that fromString is inverse to show.0.1.0

Methods

showsPrec :: Int -> IText -> ShowS #

show :: IText -> String #

showList :: [IText] -> ShowS #

IsString IText  

Methods

fromString :: String -> IText #

Generic IText  

Associated Types

type Rep IText :: * -> * #

Methods

from :: IText -> Rep IText x #

to :: Rep IText x -> IText #

Hashable IText

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.0.1.0

Methods

hashWithSalt :: Int -> IText -> Int #

hash :: IText -> Int #

ToJSON IText

Converts to JSON string via uninternText.0.1.0

ToJSONKey IText

Converts to JSON string via uninternText.0.1.0

FromJSON IText

Inverse of the ToJSON instance.0.1.0

FromJSONKey IText

Inverse of the ToJSONKey instance.0.1.0

NFData IText

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

Methods

rnf :: IText -> () #

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

Uses the Text instance.0.1.0

Methods

series :: Series m IText #

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

Uses the Text instance.0.1.0

Methods

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

type Rep IText  
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 0.1.0#

Get the Text corresponding to the given IText value.

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

internText :: Text -> IText Source 0.1.0#

Intern a Text value, resulting in an IText value.

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

itext :: Iso' Text IText Source 0.1.0#

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"