| 1 |
|
| 2 |
-- | Module for accessing minified jquery.dgtable code (<https://github.com/danielgindi/jquery.dgtable/>). |
| 3 |
-- As an example: |
| 4 |
-- |
| 5 |
-- > import qualified Language.Javascript.DGTable as DGTable |
| 6 |
-- > |
| 7 |
-- > main = do |
| 8 |
-- > putStrLn $ "jquery.dgtable version " ++ show DGTable.version ++ " source:" |
| 9 |
-- > putStrLn =<< readFile =<< DGTable.file |
| 10 |
-- |
| 11 |
-- This package installs data files containing the jquery.dgtable sources, which must be available at runtime. |
| 12 |
-- If you want to produce an executable with no dependency on associated data files, you can use the |
| 13 |
-- @file-embed@ library (<https://hackage.haskell.org/package/file-embed>): |
| 14 |
-- |
| 15 |
-- > {-# LANGUAGE TemplateHaskell #-} |
| 16 |
-- > |
| 17 |
-- > import Data.FileEmbed |
| 18 |
-- > import qualified Data.ByteString as BS |
| 19 |
-- > import qualified Language.Javascript.DGTable as DGTable |
| 20 |
-- > import Language.Haskell.TH.Syntax |
| 21 |
-- > |
| 22 |
-- > main = print dgTableContents |
| 23 |
-- > |
| 24 |
-- > dgTableContents :: BS.ByteString |
| 25 |
-- > dgTableContents = $(embedFile =<< runIO DGTable.file) |
| 26 |
module Language.Javascript.DGTable( |
| 27 |
version, file |
| 28 |
) where |
| 29 |
|
| 30 |
import qualified Paths_js_dgtable as Paths |
| 31 |
import Data.Version |
| 32 |
|
| 33 |
|
| 34 |
-- | A local file containing the minified jquery.dgtable code for 'version'. |
| 35 |
file :: IO FilePath |
| 36 |
file = Paths.getDataFileName "jquery.dgtable.min.js" |
| 37 |
|
| 38 |
-- | The version of jquery.dgtable provided by this package. Not necessarily the version of this package, |
| 39 |
-- but the versions will match in the first three digits. |
| 40 |
version :: Version |
| 41 |
version = Version (take 3 $ versionBranch Paths.version) [] |