biohazard-2.0: bioinformatics support library

Safe HaskellNone
LanguageHaskell2010

Bio.Util.Text

Synopsis

Documentation

class Unpack s where Source #

Class of things that can be unpacked into Strings. Kind of the opposite of IsString.

Methods

unpack :: s -> String Source #

Instances
Unpack String Source # 
Instance details

Defined in Bio.Util.Text

Methods

unpack :: String -> String Source #

Unpack ByteString Source # 
Instance details

Defined in Bio.Util.Text

Unpack Text Source # 
Instance details

Defined in Bio.Util.Text

Methods

unpack :: Text -> String Source #

w2c :: Word8 -> Char Source #

Conversion between Word8 and Char. Should compile to a no-op.

c2w :: Char -> Word8 Source #

Unsafe conversion between Char and Word8. This is a no-op and silently truncates to 8 bits Chars > '\255'. It is provided as convenience for ByteString construction.

decodeBytes :: ByteString -> Text Source #

Converts Bytes into Text. This uses UTF8, but if there is an error, it pretends it was Latin1. Evil as this is, it tends to Just Work on files where nobody ever wasted a thought on encodings.

encodeBytes :: Text -> ByteString Source #

Converts Text into Bytes. This uses UTF8.

decompressGzip :: ByteString -> ByteString Source #

Decompresses Gzip or Bgzf and passes everything else on. In reality, it simply decompresses Gzip, and when done, looks for another Gzip stream. Since there is a small chance to attempt decompression of an uncompressed stream, the original data is returned in case of an error.