-
-
Save Tener/4eae297562ae26781b01 to your computer and use it in GitHub Desktop.
quote a module contents with a string literal -- Template Haskell solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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