-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | GHC style name Z-encoding and Z-decoding
--   
--   Implements GHC's name mangling. This code was taken directly from the
--   GHC source.
@package zenc
@version 0.1.2


-- | The Z-encoding
--   
--   This is the main name-encoding and decoding function. It encodes any
--   string into a string that is acceptable as a C name. This is code was
--   originally part of GHC and used right before emitting a symbol name
--   into the compiled C or asm code. This library was created as this
--   encoding is useful when working with GHC compiled code or generally
--   when C-compatible name mangling is desired.
module Text.Encoding.Z

-- | The basic encoding scheme is this:
--   
--   <ul>
--   <li>Tuples (,,,) are coded as Z3T</li>
--   <li>Alphabetic characters (upper and lower) and digits all translate
--   to themselves; except <tt>Z</tt>, which translates to <tt>ZZ</tt> and
--   <tt>z</tt>, which translates to <tt>zz</tt> We need both so that we
--   can preserve the variable/tycon distinction</li>
--   <li>Most other printable characters translate to <tt>zx</tt> or
--   <tt>Zx</tt> for some alphabetic character x</li>
--   <li>The others translate as <tt>znnnU</tt> where <tt>nnn</tt> is the
--   decimal number of the character</li>
--   </ul>
--   
--   <pre>
--   Before          After
--   --------------------------
--   Trak            Trak
--   foo_wib         foozuwib
--   &gt;               zg
--   &gt;1              zg1
--   foo#            foozh
--   foo##           foozhzh
--   foo##1          foozhzh1
--   fooZ            fooZZ
--   :+              ZCzp
--   ()              Z0T     0-tuple
--   (,,,,)          Z5T     5-tuple
--   (# #)           Z1H     unboxed 1-tuple (note the space)
--   (#,,,,#)        Z5H     unboxed 5-tuple
--           (NB: There is no Z1T nor Z0H.)
--   </pre>
zEncodeString :: UserString -> EncodedString

-- | The inverse of <a>zEncodeString</a>
zDecodeString :: EncodedString -> UserString
type UserString = -- | As the user typed it String
type EncodedString = -- | Encoded form String
