fay-text-0.3.2: Fay Text type represented as JavaScript strings

Safe HaskellNone

Fay.Text.Type

Description

Module to be shared between server and client.

This module must be valid for both GHC and Fay.

For GHC this is an alias for Data.Text, for Fay it's an opaque data type represented by JavaScript strings.

Synopsis

Documentation

data Text

A space efficient, packed, unboxed Unicode text type.

Instances

Eq Text 
Data Text

This instance preserves data abstraction at the cost of inefficiency. We omit reflection services for the sake of data abstraction.

This instance was created by copying the updated behavior of Data.Set.Set and Data.Map.Map. If you feel a mistake has been made, please feel free to submit improvements.

The original discussion is archived here: could we get a Data instance for Data.Text.Text?

The followup discussion that changed the behavior of Set and Map is archived here: Proposal: Allow gunfold for Data.Map, ...

Ord Text 
Read Text 
Show Text 
Typeable Text 
IsString Text 
ToJSON Text 
FromJSON Text 
Monoid Text 
NFData Text 
ToJSON v => ToJSON (HashMap Text v) 
ToJSON v => ToJSON (Map Text v) 
FromJSON v => FromJSON (HashMap Text v) 
FromJSON v => FromJSON (Map Text v) 

pack :: String -> Text

O(n) Convert a String into a Text. Subject to fusion. Performs replacement on invalid scalar values.

unpack :: Text -> String

O(n) Convert a Text into a String. Subject to fusion.

fromString :: String -> TextSource

Have this in scope with the OverloadedStrings and BindableSyntax extensions and Fay will replace all string literals with Text.