Skip to content

-fprof-late and HasField leads to invalid json file

{-# LANGUAGE DataKinds #-}
module Main where

import GHC.Records

main = print ()

data Person = Person { name :: String }

instance HasField "fullname" Person String where
  getField = name
ghc Prof.hs -O -fprof-late -prof
./Prof +RTS -pj

Then looking in the json file you can see

{"id": 128, "label": "$fHasFieldSymbol"fullname"PersonList", "module": "Main", "src_loc": "Prof.hs:10:10-42", "is_caf": false}, 

which is not escaped properly.

cc @AndreasK

It seems that the escapeString function needs to be extended in ProfilerReportJson.c.

Edited by sheaf
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information