This commit is contained in:
Dmitry Zuikov 2024-06-03 13:35:33 +03:00
parent 641c51447f
commit 3f901966ab
2 changed files with 10 additions and 7 deletions

View File

@ -42,8 +42,6 @@ import Control.Monad.Trans.Maybe
import Streaming.Prelude qualified as S
-- FIXME: move-to-suckless-conf
deriving stock instance Ord (Syntax C)
{- HLINT ignore "Functor law" -}
@ -199,7 +197,7 @@ list_ tpl a = do
Just (Simple (SimpleTemplate simple)) -> do
for_ fixmies $ \(FixmeThin attr) -> do
let subst = [ (mksym k, mkstr @C v) | (k,v) <- HM.toList attr ]
let subst = [ (mkId k, mkstr @C v) | (k,v) <- HM.toList attr ]
let what = render (SimpleTemplate (inject subst simple))
& fromRight "render error"
@ -248,9 +246,9 @@ cat_ metaOnly hash = do
let origLen = maybe 0 fromIntegral fixmeEnd - maybe 0 fromIntegral fixmeStart & max 1
let lno = max 1 $ origLen + after + before
let dict = [ (mksym k, mkstr @C v) | (k,v) <- HM.toList fixmeAttr ]
let dict = [ (mkId k, mkstr @C v) | (k,v) <- HM.toList fixmeAttr ]
<>
[ (mksym "before", mkstr @C (FixmeAttrVal $ Text.pack $ show bbefore))
[ (mkId (FixmeAttrName "before"), mkstr @C (FixmeAttrVal $ Text.pack $ show bbefore))
]
debug (pretty cmd)

View File

@ -28,6 +28,8 @@ import Data.Map qualified as Map
import System.FilePath
import Text.InterpolatedString.Perl6 (qc)
-- FIXME: move-to-suckless-conf
deriving stock instance Ord (Syntax C)
pattern StringLike :: forall {c} . String -> Syntax c
pattern StringLike e <- (stringLike -> Just e)
@ -309,8 +311,11 @@ commentKey fp =
type ContextShit c = (Data c, Data (Context c), IsContext c, Data (Syntax c))
mksym :: FixmeAttrName -> Id
mksym (k :: FixmeAttrName) = Id ("$" <> coerce k)
class MkId a where
mkId :: a -> Id
instance MkId FixmeAttrName where
mkId (k :: FixmeAttrName) = Id ("$" <> coerce k)
mkstr :: forall c . (IsContext c) => FixmeAttrVal -> Syntax c
mkstr (s :: FixmeAttrVal) = Literal (noContext @c) (LitStr (coerce s))