IO package:text

Efficient locale-sensitive support for text I/O. The functions in this module obey the runtime system's locale, character set encoding, and line ending conversion settings. If you want to do I/O using the UTF-8 encoding, use Data.Text.IO.Utf8, which is faster than this module. If you know in advance that you will be working with data that has a specific encoding, and your application is highly performance sensitive, you may find that it is faster to perform I/O with bytestrings and to encode and decode yourself than to use the functions in this module.
Warning: this is an internal module, and does not have a stable API or name. Functions in this module may not check or enforce preconditions expected by public modules. Use at your own risk! Low-level support for text I/O.
Efficient locale-sensitive support for lazy text I/O. The functions in this module obey the runtime system's locale, character set encoding, and line ending conversion settings. If you know in advance that you will be working with data that has a specific encoding (e.g. UTF-8), and your application is highly performance sensitive, you may find that it is faster to perform I/O with bytestrings and to encode and decode yourself than to use the functions in this module.
O(n) The partition function takes a predicate and a Text, and returns the pair of Texts with elements which do and do not satisfy the predicate, respectively; i.e.
partition p t == (filter p t, filter (not . p) t)
An exception type for representing Unicode encoding errors.
Warning: this is an internal module, and does not have a stable API or name. Functions in this module may not check or enforce preconditions expected by public modules. Use at your own risk! Useful functions and combinators.
Warning: this is an internal module, and does not have a stable API or name. Functions in this module may not check or enforce preconditions expected by public modules. Use at your own risk!
Warning: this is an internal module, and does not have a stable API or name. Functions in this module may not check or enforce preconditions expected by public modules. Use at your own risk! Fusible Stream-oriented functions for converting between Text and several common encodings.
Warning: this is an internal module, and does not have a stable API or name. Functions in this module may not check or enforce preconditions expected by public modules. Use at your own risk! Text manipulation functions represented as fusible operations over streams.
Warning: this is an internal module, and does not have a stable API or name. Functions in this module may not check or enforce preconditions expected by public modules. Use at your own risk! Fusible Stream-oriented functions for converting between lazy Text and several common encodings.
Warning: this is an internal module, and does not have a stable API or name. Functions in this module may not check or enforce preconditions expected by public modules. Use at your own risk! Core stream fusion functionality for text.
Just like unsafePerformIO, but we inline it. Big performance gains as it exposes lots of things to further inlining. Very unsafe. In particular, you should do no memory allocation inside an inlinePerformIO block.
Read a rational number. This function accepts an optional leading sign character, followed by at least one decimal digit. The syntax similar to that accepted by the read function, with the exception that a trailing '.' or 'e' not followed by a number is not consumed. Examples:
rational "3"     == Right (3.0, "")
rational "3.1"   == Right (3.1, "")
rational "3e4"   == Right (30000.0, "")
rational "3.1e4" == Right (31000.0, "")
rational ".3"    == Left "input does not start with a digit"
rational "e3"    == Left "input does not start with a digit"
Examples of differences from read:
rational "3.foo" == Right (3.0, ".foo")
rational "3e"    == Right (3.0, "e")
Read a rational number. This function accepts an optional leading sign character, followed by at least one decimal digit. The syntax similar to that accepted by the read function, with the exception that a trailing '.' or 'e' not followed by a number is not consumed. Examples (with behaviour identical to read):
rational "3"     == Right (3.0, "")
rational "3.1"   == Right (3.1, "")
rational "3e4"   == Right (30000.0, "")
rational "3.1e4" == Right (31000.0, "")
rational ".3"    == Left "input does not start with a digit"
rational "e3"    == Left "input does not start with a digit"
Examples of differences from read:
rational "3.foo" == Right (3.0, ".foo")
rational "3e"    == Right (3.0, "e")
This version of unsafePerformIO is more efficient because it omits the check that the IO is only being performed by a single thread. Hence, when you use unsafeDupablePerformIO, there is a possibility that the IO action may be performed multiple times (on a multiprocessor), and you should therefore ensure that it gives the same results each time. It may even happen that one of the duplicated IO actions is only run partially, and then interrupted in the middle without an exception being raised. Therefore, functions like bracket cannot be used safely within unsafeDupablePerformIO.