chore(users/Profpatsch): clean up haskell libs a little

Change-Id: Ia9a6c5a754ca8f2912308feb5a26f5276a08d24c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9011
Reviewed-by: Profpatsch <mail@profpatsch.de>
Autosubmit: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
This commit is contained in:
Profpatsch 2023-08-06 12:46:50 +02:00 committed by clbot
parent ce4acc08a5
commit 1fd59f5158
12 changed files with 122 additions and 335 deletions

View file

@ -0,0 +1,24 @@
{-# LANGUAGE TemplateHaskellQuotes #-}
module AesonQQ where
import Data.Aeson qualified as Json
import Language.Haskell.TH.Quote (QuasiQuoter)
import PossehlAnalyticsPrelude
import PyF qualified
import PyF.Internal.QQ qualified as PyFConf
aesonQQ :: QuasiQuoter
aesonQQ =
PyF.mkFormatter
"aesonQQ"
PyF.defaultConfig
{ PyFConf.delimiters = Just ('|', '|'),
PyFConf.postProcess = \exp_ -> do
-- TODO: this does not throw an error at compilation time if the json does not parse
[|
case Json.eitherDecodeStrict' @Json.Value $ textToBytesUtf8 $ stringToText $(exp_) of
Left err -> error err
Right a -> a
|]
}