ndmitchell / js-flot

Haskell library to obtain minified Flot code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

js-flot Hackage version Stackage version Build status


WARNING: The underlying Flot library is in a weird state, you might wish to use js-chart instead, see this pull request for context.


This package bundles the minified Flot code (a jQuery plotting library) into a Haskell package, so it can be depended upon by Cabal packages. The first three components of the version number match the upstream Flot version. The package is designed to meet the redistribution requirements of downstream users (e.g. Debian). As an example:

import qualified Language.Javascript.Flot as Flot

main = do
    putStrLn $ "Flot version " ++ show Flot.version ++ " source:"
    putStrLn =<< readFile =<< Flot.file Flot.Flot

Note that Flot depends on jQuery, a Haskell version of which can be obtained from the js-jquery package.

This package installs data files containing the Flot sources, which must be available at runtime. If you want to produce an executable with no dependency on associated data files, you can use the file-embed library:

{-# LANGUAGE TemplateHaskell #-}

import Data.FileEmbed
import qualified Data.ByteString as BS
import qualified Language.Javascript.Flot as Flot
import Language.Haskell.TH.Syntax

main = print flotContents

flotContents :: BS.ByteString
flotContents = $(embedFile =<< runIO (Flot.file Flot.Flot))

About

Haskell library to obtain minified Flot code

License:MIT License


Languages

Language:Haskell 100.0%