-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Integrating Sass into Haskell applications.
--
@package hsass
@version 0.2.0
-- | Helper functions. This module is internal and should not be used in
-- production code.
module Text.Sass.Utils
-- | withOptionalCString str action, if str is
-- Nothing, action is not invoked, otherwise behaves like
-- withCString.
withOptionalCString :: 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
-- | loopCArray action list calls action over
-- each element of list 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 SassMap.
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 SassValues.
SassList :: [SassValue] -> SassSeparator -> SassValue
-- | Map.
SassMap :: [SassMapEntry] -> SassValue
-- | Null value.
SassNull :: SassValue
-- | Warning with message.
SassWarning :: String -> SassValue
-- | Error with message.
SassError :: String -> SassValue
data SassSeparator :: *
SassSeparatorComma :: SassSeparator
SassSeparatorSpace :: SassSeparator
instance Eq 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 -> IO SassValue
-- | 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
-- importPath and importBase and leave loading to the
-- library, or provide importSource and do not provide
-- importPath nor importBase. 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, relative to base.
importPath :: SassImport -> Maybe FilePath
-- | Base path.
importBase :: 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 importer/header.
--
-- You may return empty list in order to tell libsass to handle the
-- import by itself or not insert any header.
type SassImporterType = String -> IO [SassImport]
-- | Description of the importer.
data SassImporter
SassImporter :: Double -> SassImporterType -> SassImporter
-- | Priority of the importer.
importerPriority :: SassImporter -> Double
-- | Main function.
importerFunction :: SassImporter -> SassImporterType
-- | makeSourceImport s is equivalent to SassImport
-- Nothing Nothing (Just s) Nothing.
makeSourceImport :: String -> SassImport
-- | makePathImport p b is equivalent to SassImport
-- (Just p) (Just b) Nothing Nothing.
makePathImport :: String -> String -> SassImport
-- | Conversion of SassValue or list of SassValues into
-- native representation. This module is internal and should not be
-- considered stable.
module Text.Sass.Values.Internal
-- | Converts a SassValue to native type.
toNativeValue :: SassValue -> IO (Ptr SassValue)
-- | Converts native value to SassValue.
fromNativeValue :: Ptr SassValue -> IO SassValue
-- | Frees native representation of SassValue.
deleteNativeValue :: Ptr SassValue -> IO ()
-- | Makes ForeignPtr from Ptr to native representation of
-- SassValue.
makeValueForeignPtr :: Ptr SassValue -> IO (ForeignPtr SassValue)
module Text.Sass.Functions.Internal
-- | Wraps function of type SassFunctionType into function that may
-- be passed to native library.
wrapFunction :: SassFunctionType -> SassFunctionFnType
-- | Converts SassFunction into native representation.
--
-- Freeing native representation is not a pleasant process - libsass
-- frees the SassFunctionEntry, but does not free signature.
-- Because of that, special care must be taken in order to properly
-- deallocate the object. If you don't want to pass the resulting object
-- to Sass_Options, call both clearNativeFunction and then
-- freeNativeFunction. Otherwise, you should call
-- clearNativeFunction BEFORE you deallocate context.
makeNativeFunction :: SassFunction -> IO SassFunctionEntry
-- | Releases the signature of a function entry.
clearNativeFunction :: SassFunctionEntry -> IO ()
-- | Deallocates the object, but does not deallocate signature.
freeNativeFunction :: SassFunctionEntry -> IO ()
-- | Converts list of SassFunctions into native representation.
--
-- There is analogous problem in relation to deallocation of the result
-- as with makeNativeFunction. See documentation above for
-- explanation.
makeNativeFunctionList :: [SassFunction] -> IO SassFunctionList
-- | Releases signatures of entries in the list.
clearNativeFunctionList :: SassFunctionList -> IO ()
-- | Frees the list and entries, without releasing signatures.
freeNativeFunctionList :: SassFunctionList -> IO ()
-- | Wraps function of type SassImporterType.
wrapImporter :: SassImporterType -> SassImporterFnType
-- | Converts SassImport into native representation.
makeNativeImport :: SassImport -> IO SassImportEntry
-- | Frees native representation of SassImport.
freeNativeImport :: SassImportEntry -> IO ()
-- | Converts list of SassImports into native representation.
makeNativeImportList :: [SassImport] -> IO SassImportList
-- | Frees native representation of list of SassEntry, including
-- entries.
freeNativeImportList :: SassImportList -> IO ()
-- | Converts SassImporter into native representation.
makeNativeImporter :: SassImporter -> IO SassImporterEntry
-- | Frees native representation of SassImporter.
freeNativeImporter :: SassImporterEntry -> IO ()
-- | Makes native representation of list of SassImporters.
makeNativeImporterList :: [SassImporter] -> IO SassImporterList
-- | Frees list of native representations of SassImporters.
--
-- Libsass does not provide function to free this kind of objects, but we
-- provide it just in case.
freeNativeImporterList :: SassImporterList -> IO ()
-- | Compilation options.
module Text.Sass.Options
-- | Describes options used by libsass during compilation.
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 [SassImporter] -> Maybe [SassImporter] -> 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 [SassImporter]
-- | List of user-supplied functions that resolve @import directives.
sassImporters :: SassOptions -> Maybe [SassImporter]
-- | Defines output style of compiled CSS.
data SassOutputStyle :: *
SassStyleNested :: SassOutputStyle
SassStyleExpanded :: SassOutputStyle
SassStyleCompact :: SassOutputStyle
SassStyleCompressed :: SassOutputStyle
instance Default SassOptions
-- | Copying SassOptions into native context. This module is
-- internal and should not be considered stable.
module Text.Sass.Options.Internal
-- | Copies SassOptions to native object, excluding
-- sassFunctions.
copyOptionsToNative :: SassOptions -> Ptr SassOptions -> IO ()
-- | Copies sassFunctions to native object, executes action, clears
-- leftovers (see documentation of makeNativeFunction) 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)
-- | Represents extended result - compiled string with a list of includes
-- and a source map.
--
-- Subject to name change in future versions.
data SassExtendedResult
-- | Result of compilation - Either SassError or a compiled
-- string.
--
-- Subject to name change in future versions.
type StringResult = IO (Either SassError String)
-- | Result of compilation - Either SassError or extended
-- results - a compiled string with a list of included files and a source
-- map.
--
-- Subject to name change in future versions.
type ExtendedResult = IO (Either SassError SassExtendedResult)
-- | Compiled string.
resultString :: SassExtendedResult -> String
-- | Loads a list of files that have been included during compilation.
resultIncludes :: SassExtendedResult -> IO [String]
-- | Loads a source map if it was generated by libsass.
resultSourcemap :: SassExtendedResult -> 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 SassResult SassExtendedResult
instance SassResult String
instance Show SassExtendedResult
instance Eq SassError
instance Show SassError
-- | This module provides support for Sass, 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
-- test/Text/Sass/TutorialSpec.hs.
module Text.Sass