From 291bc460d522b2e2c785ec3c3b71a80f22b67853 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 3 Oct 2020 03:23:18 +0200 Subject: tv xmonad: read screen/font width from build env --- tv/5pkgs/haskell/xmonad-tv/src/THEnv/JSON.hs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tv/5pkgs/haskell/xmonad-tv/src/THEnv/JSON.hs (limited to 'tv/5pkgs/haskell/xmonad-tv/src/THEnv') diff --git a/tv/5pkgs/haskell/xmonad-tv/src/THEnv/JSON.hs b/tv/5pkgs/haskell/xmonad-tv/src/THEnv/JSON.hs new file mode 100644 index 000000000..2a3a0e523 --- /dev/null +++ b/tv/5pkgs/haskell/xmonad-tv/src/THEnv/JSON.hs @@ -0,0 +1,18 @@ +{-# LANGUAGE ScopedTypeVariables #-} + +module THEnv.JSON where + +import Data.Aeson (eitherDecode,FromJSON) +import Data.ByteString.Lazy.Char8 (pack) +import Language.Haskell.TH.Syntax (Exp,Lift(lift),Q) +import THEnv (getCompileEnv) +import Control.Monad + +getCompileEnvJSON :: (FromJSON a) => String -> Q a +getCompileEnvJSON name = + either error (id :: a -> a) . eitherDecode . pack <$> getCompileEnv name + +getCompileEnvJSONExp :: + forall proxy a. (FromJSON a, Lift a) => proxy a -> String -> Q Exp +getCompileEnvJSONExp _ = + (lift :: a -> Q Exp) <=< getCompileEnvJSON -- cgit v1.2.3