repl> newtype Person = Person Int deriving Show
repl> personDecoder = withObject $ \obj -> Person <$> atKey "lol" int obj
repl> decodeEither personDecoder "\x00"
Left (SIMDException (HError {path = "", errorMsg = "A JSON document made of a scalar (number, Boolean, null or string) is treated as a value. Use get_bool(), get_double(), etc. on the document instead. ", docLocation = "", docDebug = "json_iterator [ depth : 1, structural : '\NUL/\DEL\NUL\NULO\aB\NUL\NUL\NULA\nB\NUL\NUL\NULh(\DEL\NUL\NUL\SOH\NUL\NUL\NUL"}))
repl> decodeEither personDecoder "\x00"
Left (SIMDException (HError {path = "", errorMsg = "A JSON document made of a scalar (number, Boolean, null or string) is treated as a value. Use get_bool(), get_double(), etc. on the document instead. ", docLocation = "", docDebug = "json_iterator [ depth : 1, structural : '\NULM\ETXB\NUL\NUL\NUL`(\DEL\NUL\NUL9M\ETXB\NUL\NUL\NUL7M\ETXB\NUL\NUL\NUL\EMe^\EOT"}))
repl> decodeEither personDecoder "\x00"
Left (SIMDException (HError {path = "", errorMsg = "A JSON document made of a scalar (number, Boolean, null or string) is treated as a value. Use get_bool(), get_double(), etc. on the document instead. ", docLocation = "", docDebug = "json_iterator [ depth : 1, structural : '\NUL\STX\tB\NUL\NUL\NULy\ETXB\NUL\NUL\NULJ~\ETXB\NUL\NUL\NULh(\DEL\NUL\NUL\SOH\NUL\NUL\NUL"}))
Scroll to the end of the line to see some garbage data.
The fact that the same input bytestring returns unequal errors breaks referential transparency, which users expect.
This also makes it harder to use Hermes in property testing.
repl> fromLeft undefined (decodeEither personDecoder "\x00") == fromLeft undefined (decodeEither personDecoder "\x00")
False