File: EmbeddedData.hs

package info (click to toggle)
haskell-criterion 1.6.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 360 kB
  • sloc: haskell: 1,891; javascript: 811; makefile: 3
file content (28 lines) | stat: -rw-r--r-- 832 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{-# LANGUAGE TemplateHaskell #-}

-- |
-- Module      : Criterion.EmbeddedData
-- Copyright   : (c) 2017 Ryan Scott
--
-- License     : BSD-style
-- Maintainer  : bos@serpentine.com
-- Stability   : experimental
-- Portability : GHC
--
-- When the @embed-data-files@ @Cabal@ flag is enabled, this module exports
-- the contents of various files (the @data-files@ from @criterion.cabal@, as
-- well as a minimized version of Chart.js) embedded as a 'ByteString'.
module Criterion.EmbeddedData
  ( dataFiles
  , chartContents
  ) where

import Data.ByteString (ByteString)
import Data.FileEmbed (embedDir, embedFile)
import Language.Haskell.TH.Syntax (runIO)

dataFiles :: [(FilePath, ByteString)]
dataFiles = $(embedDir "templates")

chartContents :: ByteString
chartContents = $(embedFile "/usr/share/javascript/chart.js/Chart.js")