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


-- | Integrating Sass into Haskell applications.
--   
--   This package provides quite simple (but not too simple) API for
--   compilation of <a>Sass</a> code. It uses <a>libsass</a> (hlibsass)
--   underneath, so the code it parses/generates should be compatible with
--   original Sass implementation (or at least <a>sassc</a>). This package
--   tries to minimize C API usage, so the only place where it is used is
--   in the <a>compileFile</a> / <a>compileString</a> methods. This allows
--   us to stay pure as long as we can and not waste performance for going
--   back and forth. If you feel that compilation options constrain you too
--   much, you may use rest of modules without it. With them, you can use
--   Haskell types and mechanisms to manage libsass's data(eg. importers,
--   options, values) and modify compilation process as you like.
@package hsass
@version 0.8.0


-- | Helper functions used by Compilation module.
module Text.Sass.Marshal.Internal

-- | Marshal a NUL terminated C string (UTF-8 encoded) into Haskell string.
--   It is equivalent to <a>peekCString</a> but with different encoding.
peekUTF8CString :: CString -> IO String

-- | Marshal a Haskell string into a NUL terminated C string (UTF-8
--   encoded). It is equivalent to <a>newCString</a> but with different
--   encoding.
newUTF8CString :: String -> IO CString

-- | Marshal a Haskell string into a C string (i.e., character array) in
--   temporary storage, with explicit length information. It is equivalent
--   to <a>withCString</a> but with different encoding.
withUTF8CString :: String -> (CString -> IO a) -> IO a

-- | Copies <a>ByteString</a> to newly allocated <a>CString</a>. The result
--   must be explicitly freed using <a>free</a> or <a>finalizerFree</a>.
newCStringFromBS :: ByteString -> IO CString


-- | Helper functions. This module is internal and should not be used in
--   production code.
module Text.Sass.Utils

-- | <tt>withOptionalCString</tt> <tt>str action</tt>, if <tt>str</tt> is
--   <tt>Nothing</tt>, <tt>action</tt> is not invoked, otherwise behaves
--   like <a>withCString</a>.
withOptionalUTF8CString :: Maybe String -> (CString -> IO ()) -> IO ()

-- | Checks if the pointer in state points to non-null location.
listEntryNotNull :: (Monad m, MonadIO m) => StateT (Ptr (Ptr a)) m Bool

-- | <tt>loopCArray</tt> <tt>action list</tt> calls <tt>action</tt> over
--   each element of <tt>list</tt> that is C array with NULL signifying end
--   of array.
loopCList :: (Monad m, MonadIO m) => (Ptr a -> m ()) -> Ptr (Ptr a) -> m ()

-- | Copies converted list of elements to new C array.
copyToCList :: (Num size, Enum size) => (CSize -> IO list) -> (a -> IO element) -> (list -> size -> element -> IO ()) -> [a] -> IO list

-- | Concatenates list of paths, separating entries with appropriate
--   character.
concatPaths :: [FilePath] -> FilePath

-- | Generates array indices for array of specified length.
arrayRange :: (Num a, Integral a, Enum a) => a -> [a]


-- | Provides API for managing values that may be extracter from or
--   injected to sass source file.
module Text.Sass.Values

-- | Entry of <a>SassMap</a>.
type SassMapEntry = (SassValue, SassValue)

-- | Represents value used by libsass.
data SassValue

-- | Boolean value.
SassBool :: Bool -> SassValue

-- | Number (value and unit).
SassNumber :: Double -> String -> SassValue

-- | RGBA color.
SassColor :: Double -> Double -> Double -> Double -> SassValue
[sassColorR] :: SassValue -> Double
[sassColorG] :: SassValue -> Double
[sassColorB] :: SassValue -> Double
[sassColorA] :: SassValue -> Double

-- | String
SassString :: String -> SassValue

-- | List of <a>SassValue</a>s.
SassList :: [SassValue] -> SassSeparator -> SassValue

-- | Map.
SassMap :: [SassMapEntry] -> SassValue

-- | Null value.
SassNull :: SassValue

-- | Warning with message.
SassWarning :: String -> SassValue

-- | Error with message.
SassError :: String -> SassValue

-- | Separator used in Sass lists.
data SassSeparator
SassSeparatorComma :: SassSeparator
SassSeparatorSpace :: SassSeparator

-- | Marked as internal
SassSeparatorHash :: SassSeparator
instance GHC.Show.Show Text.Sass.Values.SassValue
instance GHC.Classes.Eq Text.Sass.Values.SassValue


-- | Provides support for user-defined functions, importers and headers.
module Text.Sass.Functions

-- | Type of the function that may be used in sass source.
type SassFunctionType = SassValue " Arguments of the function ('SassList')." -> IO SassValue " Result of the computation."

-- | Description of the function that may be used in sass source.
data SassFunction
SassFunction :: String -> SassFunctionType -> SassFunction

-- | Signature of the function, parsable by libsass.
[funcSignature] :: SassFunction -> String

-- | Main function.
[funcComputation] :: SassFunction -> SassFunctionType

-- | Represents a sass import - a sass content with additional metadata.
--   
--   Even though this ADT has four fields, you may just provide either
--   <a>importPath</a> and <a>importAbsolutePath</a> and leave loading to
--   the library, or provide <a>importSource</a> and do not provide
--   <a>importAbsolutePath</a>. Nevertheless, you are free to provide all
--   of the fields.
data SassImport
SassImport :: Maybe FilePath -> Maybe FilePath -> Maybe String -> Maybe String -> SassImport

-- | Path to the import, as requested by the import statement.
[importPath] :: SassImport -> Maybe FilePath

-- | Absolute path to the file.
[importAbsolutePath] :: SassImport -> Maybe FilePath

-- | Import's source.
[importSource] :: SassImport -> Maybe String

-- | Source map of the import.
[importSourceMap] :: SassImport -> Maybe String

-- | Type of the function that acts like an importer.
--   
--   You may return the empty list in order to tell libsass to handle the
--   import by itself.
type SassImporterType = String " Path to the import that needs to be loaded." -> String " Absolute path to the importing file." -> IO [SassImport] " Imports."

-- | Description of the importer.
data SassImporter
SassImporter :: Double -> SassImporterType -> SassImporter

-- | Priority of the importer.
[importerPriority] :: SassImporter -> Double

-- | Main function.
[importerFunction] :: SassImporter -> SassImporterType

-- | Type of the function that acts like a header.
type SassHeaderType = String " Absolute path to the file being processed." -> IO [SassImport] " Imports."

-- | Description of the header.
data SassHeader
SassHeader :: Double -> SassHeaderType -> SassHeader

-- | Priority of the header.
[headerPriority] :: SassHeader -> Double

-- | Main function.
[headerFunction] :: SassHeader -> SassHeaderType

-- | <a>makeSourceImport</a> <tt>s</tt> is equivalent to <a>SassImport</a>
--   <tt>Nothing Nothing (Just s) Nothing</tt>.
makeSourceImport :: String -> SassImport

-- | <a>makePathImport</a> <tt>p</tt> is equivalent to <a>SassImport</a>
--   <tt>(Just p) (Just p) Nothing Nothing</tt>.
makePathImport :: String -> SassImport


-- | Compilation options.
module Text.Sass.Options

-- | Describes compilation options. With the exception of
--   <a>sassStripEncodingInfo</a>, these correspond to the compilation
--   options of libsass.
data SassOptions
SassOptions :: Int -> SassOutputStyle -> Bool -> Bool -> Bool -> Bool -> Bool -> String -> String -> Maybe FilePath -> Maybe FilePath -> Maybe [FilePath] -> Maybe [FilePath] -> Maybe FilePath -> Maybe String -> Maybe [SassFunction] -> Maybe [SassHeader] -> Maybe [SassImporter] -> Bool -> SassOptions

-- | Precision of fractional numbers.
[sassPrecision] :: SassOptions -> Int

-- | Output style for the generated css code.
[sassOutputStyle] :: SassOptions -> SassOutputStyle

-- | Emit comments in the generated CSS indicating the corresponding source
--   line.
[sassSourceComments] :: SassOptions -> Bool

-- | Embed sourceMappingUrl as data uri.
[sassSourceMapEmbed] :: SassOptions -> Bool

-- | Embed include contents in maps.
[sassSourceMapContents] :: SassOptions -> Bool

-- | Disable sourceMappingUrl in css output.
[sassOmitSourceMapUrl] :: SassOptions -> Bool

-- | Treat source_string as sass (as opposed to scss).
[sassIsIndentedSyntax] :: SassOptions -> Bool

-- | String to be used for indentation.
[sassIndent] :: SassOptions -> String

-- | String to be used to for line feeds.
[sassLinefeed] :: SassOptions -> String

-- | The input path used for source map generation. It can be used to
--   define something with string compilation or to overload the input file
--   path.
[sassInputPath] :: SassOptions -> Maybe FilePath

-- | The output path used for source map generation.
[sassOutputPath] :: SassOptions -> Maybe FilePath

-- | Paths used to load plugins by libsass.
[sassPluginPaths] :: SassOptions -> Maybe [FilePath]

-- | Paths used to resolve @include.
[sassIncludePaths] :: SassOptions -> Maybe [FilePath]

-- | Path to source map file. Enables source map generation and is used to
--   create sourceMappingUrl
[sassSourceMapFile] :: SassOptions -> Maybe FilePath

-- | Directly inserted in source maps.
[sassSourceMapRoot] :: SassOptions -> Maybe String

-- | List of user-supplied functions that may be used in sass files.
[sassFunctions] :: SassOptions -> Maybe [SassFunction]

-- | List of user-supplied functions that provide "headers" for sass files.
--   Header is injected at the beginning of a file which name is passed as
--   the first argument of importer.
[sassHeaders] :: SassOptions -> Maybe [SassHeader]

-- | List of user-supplied functions that resolve @import directives.
[sassImporters] :: SassOptions -> Maybe [SassImporter]

-- | Remove <tt>@charset "UTF-8";\n</tt> or byte-order mark from CSS
--   output, if present.
[sassStripEncodingInfo] :: SassOptions -> Bool

-- | The default <a>SassOptions</a>:
--   
--   <ul>
--   <li><a>sassPrecision</a> = 5</li>
--   <li><a>sassOutputStyle</a> = <a>SassStyleNested</a></li>
--   <li><a>sassIndent</a> = two spaces</li>
--   <li><a>sassLinefeed</a> = <tt>"\n"</tt></li>
--   <li>All other fields default to <a>False</a> or <a>Nothing</a>.</li>
--   </ul>
defaultSassOptions :: SassOptions

-- | Defines output style of compiled CSS.
data SassOutputStyle
SassStyleNested :: SassOutputStyle
SassStyleExpanded :: SassOutputStyle
SassStyleCompact :: SassOutputStyle
SassStyleCompressed :: SassOutputStyle

-- | Marked as internal
SassStyleInspect :: SassOutputStyle

-- | Marked as internal
SassStyleToSass :: SassOutputStyle
instance Data.Default.Class.Default Text.Sass.Options.SassOptions


-- | Conversion of <a>SassValue</a> or list of <a>SassValue</a>s into
--   native representation. This module is internal and should not be
--   considered stable.
module Text.Sass.Values.Internal

-- | Converts a <a>SassValue</a> to native type.
toNativeValue :: SassValue -> IO (Ptr SassValue)

-- | Converts native value to <a>SassValue</a>.
fromNativeValue :: Ptr SassValue -> IO SassValue

-- | Frees native representation of <a>SassValue</a>.
deleteNativeValue :: Ptr SassValue -> IO ()

-- | Makes <a>ForeignPtr</a> from <a>Ptr</a> to native representation of
--   <a>SassValue</a>.
makeValueForeignPtr :: Ptr SassValue -> IO (ForeignPtr SassValue)

module Text.Sass.Functions.Internal

-- | Wraps function of type <a>SassFunctionType</a> into function that may
--   be passed to native library.
wrapFunction :: SassFunctionType -> SassFunctionFnType

-- | Converts <a>SassFunction</a> into native representation.
--   
--   If you don't want to pass the resulting object to Sass_Options, call
--   <a>freeNativeFunction</a>.
makeNativeFunction :: SassFunction -> IO SassFunctionEntry

-- | Deallocates the object, but does not deallocate signature.
freeNativeFunction :: SassFunctionEntry -> IO ()

-- | Converts list of <a>SassFunction</a>s into native representation.
--   
--   There is analogous problem in relation to deallocation of the result
--   as with <a>makeNativeFunction</a>. See documentation above for
--   explanation.
makeNativeFunctionList :: [SassFunction] -> IO SassFunctionList

-- | Frees the list and entries, without releasing signatures.
freeNativeFunctionList :: SassFunctionList -> IO ()

-- | Wraps function of type <a>SassImporterType</a>.
wrapImporter :: SassImporterType -> SassImporterFnType

-- | Converts <a>SassImport</a> into native representation.
makeNativeImport :: SassImport -> IO SassImportEntry

-- | Frees native representation of <a>SassImport</a>.
freeNativeImport :: SassImportEntry -> IO ()

-- | Converts list of <a>SassImport</a>s into native representation.
makeNativeImportList :: [SassImport] -> IO SassImportList

-- | Frees native representation of list of <tt>SassEntry</tt>, including
--   entries.
freeNativeImportList :: SassImportList -> IO ()

-- | Converts <a>SassImporter</a> into native representation.
makeNativeImporter :: SassImporter -> IO SassImporterEntry

-- | Frees native representation of <a>SassImporter</a>.
freeNativeImporter :: SassImporterEntry -> IO ()

-- | Makes native representation of list of <a>SassImporter</a>s.
makeNativeImporterList :: [SassImporter] -> IO SassImporterList

-- | Frees list of native representations of <a>SassImporter</a>s.
--   
--   Libsass does not provide function to free this kind of objects, but we
--   provide it just in case.
freeNativeImporterList :: SassImporterList -> IO ()


-- | Copying <a>SassOptions</a> into native context. This module is
--   internal and should not be considered stable.
module Text.Sass.Options.Internal

-- | Copies <a>SassOptions</a> to native object, excluding
--   <a>sassFunctions</a>.
copyOptionsToNative :: SassOptions -> Ptr SassOptions -> IO ()

-- | Copies <a>sassFunctions</a> to native object, executes action, clears
--   leftovers (see documentation of <a>makeNativeFunction</a>) and returns
--   action result.
withFunctions :: SassOptions -> Ptr SassOptions -> IO a -> IO a


-- | Compilation of sass source or sass files.
module Text.Sass.Compilation

-- | Compiles a file using specified options.
compileFile :: SassResult a => FilePath -> SassOptions -> IO (Either SassError a)

-- | Compiles raw Sass content using specified options.
compileString :: SassResult a => String -> SassOptions -> IO (Either SassError a)

-- | Compiles raw Sass content using specified options.
compileByteString :: SassResult a => ByteString -> SassOptions -> IO (Either SassError a)

-- | Represents extended result - compiled string (or other string-like
--   type, eg. <a>ByteString</a>) with a list of includes and a source map.
--   
--   Subject to name change in future.
data SassExtendedResult a

-- | Result of compilation - <a>Either</a> <a>SassError</a> or a compiled
--   string.
--   
--   Subject to name change in future.
type StringResult = IO (Either SassError String)

-- | Result of compilation - <a>Either</a> <a>SassError</a> or extended
--   results - a compiled string with a list of included files and a source
--   map.
--   
--   Subject to name change in future.
type ExtendedResult = IO (Either SassError (SassExtendedResult String))

-- | Result of compilation - <a>Either</a> <a>SassError</a> or extended
--   results - a compiled <a>ByteString</a> with a list of included files
--   and a source map.
--   
--   Subject to name change in future.
type ExtendedResultBS = IO (Either SassError (SassExtendedResult ByteString))

-- | Compiled string.
resultString :: SassExtendedResult a -> a

-- | Loads a list of files that have been included during compilation.
resultIncludes :: SassExtendedResult a -> IO [String]

-- | Loads a source map if it was generated by libsass.
resultSourcemap :: SassExtendedResult a -> IO (Maybe String)

-- | Represents compilation error.
data SassError

-- | Compilation satus code.
errorStatus :: SassError -> Int

-- | Loads information about an error as JSON.
errorJson :: SassError -> IO String

-- | Loads an error text.
errorText :: SassError -> IO String

-- | Loads a user-friendly error message.
errorMessage :: SassError -> IO String

-- | Loads a filename where problem occured.
errorFile :: SassError -> IO String

-- | Loads an error source.
errorSource :: SassError -> IO String

-- | Loads a line in the file where problem occured.
errorLine :: SassError -> IO Int

-- | Loads a line in the file where problem occured.
errorColumn :: SassError -> IO Int
instance Text.Sass.Compilation.SassResult GHC.Base.String
instance Text.Sass.Compilation.SassResult Data.ByteString.Internal.ByteString
instance Text.Sass.Compilation.SassResult a => Text.Sass.Compilation.SassResult (Text.Sass.Compilation.SassExtendedResult a)
instance GHC.Show.Show (Text.Sass.Compilation.SassExtendedResult a)
instance GHC.Show.Show Text.Sass.Compilation.SassError
instance GHC.Classes.Eq Text.Sass.Compilation.SassError


-- | This module provides support for <a>Sass</a>, a CSS extension
--   language. It supports basic compilation, functions, importers and
--   headers, so it should suffice for most of the work.
--   
--   Code used in this document is testable - see
--   <tt>test/Text/Sass/TutorialSpec.hs</tt>.
module Text.Sass

-- | The default value for this type.
def :: Default a => a


-- | Provides utility functions for working with <tt>SassValues</tt>
module Text.Sass.Values.Utils

-- | Combines two <a>SassValue</a>s using specified operator. | | Uses
--   <a>sass_value_op</a>.
combineSassValues :: SassOp -> SassValue -> SassValue -> SassValue

-- | Operator used to combine two <a>SassValue</a>s.
data SassOp
SassAnd :: SassOp
SassOr :: SassOp
SassEq :: SassOp
SassNeq :: SassOp
SassGt :: SassOp
SassGte :: SassOp
SassLt :: SassOp
SassLte :: SassOp
SassAdd :: SassOp
SassSub :: SassOp
SassMul :: SassOp
SassDiv :: SassOp
SassMod :: SassOp
SassNumOps :: SassOp
