king: properly mark named I hope in th

This commit is contained in:
pilfer-pandex 2021-07-23 19:11:00 -04:00
parent 0c96d9d6e8
commit 11d18a7026

View File

@ -107,12 +107,14 @@ addErrTag :: String -> Exp -> Exp
addErrTag tag exp =
-- This spurious let is inserted so we can get better cost center data
-- during heap profiling.
LetE [ValD (VarP nom) (NormalB bod) []] (VarE nom)
LetE [ValD (VarP nom) (NormalB nam) []]
$ InfixE (Just $ VarE nom) (VarE (mkName ".")) (Just exp)
where
-- XX arguably we should use newName rather than mkName here
nom = mkName $ "named_" ++ filter C.isAlphaNum tag
str = LitE $ StringL tag
bod = InfixE (Just $ AppE (VarE 'named) str) (VarE (mkName ".")) (Just exp)
nam = LamE [VarP $ mkName "x"] $ AppE (AppE (VarE 'named) str)
$ VarE (mkName "x")
deriveFromNoun :: Name -> Q [Dec]
deriveFromNoun tyName = do