Create a gist now

Instantly share code, notes, and snippets.

@Tener /Config.hs Secret
Created Jan 10, 2012

What would you like to do?
quote a module contents with a string literal -- Template Haskell solution
{-# LANGUAGE TemplateHaskell #-}
module Config where
import Language.Haskell.TH
import Data.List.Split (splitOn)
-- START
-- extractCtxs'dumpSize :: Int
-- extractCtxs'dumpSize = 100000
extractCtxs'ctxSize :: Int
extractCtxs'ctxSize = 300
extractCtxs'sparse :: Bool
extractCtxs'sparse = True
selectWords'dropBorder :: Int
selectWords'dropBorder = 20000
selectWords'takeCount :: Int
selectWords'takeCount = 100
-- STOP
config' = $(do
s <- runIO $ readFile "lib/Config.hs"
return $ LitE $ stringL s)
config = head . splitOn "-- STOP" . head . tail . splitOn "-- START" $ config'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment