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

-- | Windows code page library for Haskell
--   
--   This library provides two modules:
--   
--   
--   
- System.IO.CodePage: a cross-platform module that exports
--   functions which adjust code pages on Windows, and do nothing on other
--   operating systems.
--   
- System.Win32.CodePage: On Windows, this exports functions
--   for getting, setting, and analyzing code pages. On other operating
--   systems, this module exports nothing.
--   
@package code-page
@version 0.2.1

-- | Various internals used by System.IO.CodePage.
--   
--   Note that this is an internal module, and as such, the API presented
--   here is not guaranteed to be stable, even between minor releases of
--   this library.
module System.IO.CodePage.Internal

-- | A numeric type representing Windows code pages.
type CodePage = Word32

-- | The UTF-8 code page.
cp65001 :: CodePage

-- | The UTF-16LE code page.
cp1200 :: CodePage

-- | The UTF-16BE code page.
cp1201 :: CodePage

-- | The UTF-32LE code page.
cp12000 :: CodePage

-- | The UTF-32BE code page.
cp12001 :: CodePage

-- | The Latin1 code page.
cp1252 :: CodePage

-- | Options that specify how withCodePage and friends should
--   work.
data Options
Options :: Bool -> NonWindowsBehavior -> Options

-- | If True, emit a warning to stderr indicating that the
--   code page has been changed. If False, don't emit any warnings.
[chatty] :: Options -> Bool

-- | Configures how withCodePage and friends should work on
--   non-Windows operating systems.
[nonWindowsBehavior] :: Options -> NonWindowsBehavior

-- | The default Options:
--   
--   
--   Options
--   { chatty = False
--   , nonWindowsBehavior =
--       nonWindowsFallbackCodePageEncoding defaultFallbackCodePageEncoding
--   }
--   
defaultOptions :: Options

-- | Specifies how withCodePage and friends should work on
--   operating systems other than Windows.
data NonWindowsBehavior

-- | Don't do anything at all on non-Windows OSes.
NonWindowsDoNothing :: NonWindowsBehavior

-- | On non-Windows OSes, change the TextEncoding by converting the
--   CodePage argument to a TextEncoding using the supplied
--   function.
NonWindowsFallbackCodePageEncoding :: (CodePage -> TextEncoding) -> NonWindowsBehavior

-- | Don't do anything at all on non-Windows OSes.
nonWindowsDoNothing :: NonWindowsBehavior

-- | On non-Windows OSes, change the TextEncoding by converting the
--   CodePage argument to a TextEncoding using the supplied
--   function.
nonWindowsFallbackCodePageEncoding :: (CodePage -> TextEncoding) -> NonWindowsBehavior

-- | Provides a best-effort attempt to convert a CodePage to a
--   TextEncoding on non-Windows OSes. Errors if given a
--   CodePage that it doesn't know how to convert.
defaultFallbackCodePageEncoding :: CodePage -> TextEncoding

-- | Exports functions which adjust code pages on Windows, and do nothing
--   on other operating systems.
module System.IO.CodePage

-- | Sets the code page for an action to UTF-8 as necessary.
withCP65001 :: IO a -> IO a

-- | Sets the code page for an action to UTF-16LE as necessary.
withCP1200 :: IO a -> IO a

-- | Sets the code page for an action to UTF-16BE as necessary.
withCP1201 :: IO a -> IO a

-- | Sets the code page for an action to UTF-32LE as necessary.
withCP12000 :: IO a -> IO a

-- | Sets the code page for an action to UTF-32BE as necessary.
withCP12001 :: IO a -> IO a

-- | Sets the code page for an action to Latin1 as necessary.
withCP1252 :: IO a -> IO a

-- | Sets the code page for an action as necessary.
--   
--   On operating systems besides Windows, this will make an effort to
--   change the current TextEncoding to something that is equivalent
--   to the supplied CodePage. Currently, the only supported
--   CodePages on non-Windows OSes are cp65001,
--   cp1200, cp1201, cp12000, and cp12001.
--   Supplying any other CodePage will result in a runtime error on
--   non-Windows OSes. (If you would like to configure this behavior, use
--   withCodePageOptions instead.)
withCodePage :: CodePage -> IO a -> IO a

-- | Sets the code page for an action as necessary. If the Bool
--   argument is True, this function will emit a warning to
--   stderr indicating that the code page has been changed.
--   (withCodePage sets this argument to False.)
withCodePageOptions :: Options -> CodePage -> IO a -> IO a

-- | A numeric type representing Windows code pages.
type CodePage = Word32

-- | The UTF-8 code page.
cp65001 :: CodePage

-- | The UTF-16LE code page.
cp1200 :: CodePage

-- | The UTF-16BE code page.
cp1201 :: CodePage

-- | The UTF-32LE code page.
cp12000 :: CodePage

-- | The UTF-32BE code page.
cp12001 :: CodePage

-- | The Latin1 code page.
cp1252 :: CodePage

-- | Options that specify how withCodePage and friends should
--   work.
data Options

-- | The default Options:
--   
--   
--   Options
--   { chatty = False
--   , nonWindowsBehavior =
--       nonWindowsFallbackCodePageEncoding defaultFallbackCodePageEncoding
--   }
--   
defaultOptions :: Options

-- | If True, emit a warning to stderr indicating that the
--   code page has been changed. If False, don't emit any warnings.
chatty :: Options -> Bool

-- | Configures how withCodePage and friends should work on
--   non-Windows operating systems.
nonWindowsBehavior :: Options -> NonWindowsBehavior

-- | Specifies how withCodePage and friends should work on
--   operating systems other than Windows.
data NonWindowsBehavior

-- | Don't do anything at all on non-Windows OSes.
nonWindowsDoNothing :: NonWindowsBehavior

-- | On non-Windows OSes, change the TextEncoding by converting the
--   CodePage argument to a TextEncoding using the supplied
--   function.
nonWindowsFallbackCodePageEncoding :: (CodePage -> TextEncoding) -> NonWindowsBehavior

-- | Provides a best-effort attempt to convert a CodePage to a
--   TextEncoding on non-Windows OSes. Errors if given a
--   CodePage that it doesn't know how to convert.
defaultFallbackCodePageEncoding :: CodePage -> TextEncoding

-- | On Windows, this exports functions for getting, setting, and analyzing
--   code pages. On other operating systems, this exports nothing.
module System.Win32.CodePage
