Need better error message on runtime errors
> not (Any.unsafeExtract (Any "hello"))
Now evaluating any watch expressions (lines starting with `>`)... Ctrl+C cancels.
dumpData: bad closure: Foreign (Wrap ##Text "hello")
expected type: ##Boolean
Sure, it's unsafe, but the message should still include a trace.
I’m running into this, but with a more complicated closure, apparently:
dataBranch: bad closure: PAp (CIx (ReferenceDerived (Id "02btgjevuvmqndr35f6g4sgupu5d1d747esqjrqn7tqlqelj8fkc8" 0)) 635 0) (LamI 6 11 (Let (App False (Env (CIx (ReferenceDerived (Id "01dfuifohdt991v9qmk3umdc2nv6ugmg8e7m7vsl7jrncsbj16b9m" 0)) 633 0) <RCOMB>) (VArgN (fromListN 4 [0,1,2,3]))) (CIx (ReferenceDerived (Id "02btgjevuvmqndr35f6g4sgupu5d1d747esqjrqn7tqlqelj8fkc8" 0)) 635 1) 11 (Ins (Lit (MT "3rfcNHYJY1ZVvWVs7j")) (Ins (Pack (ReferenceDerived (Id "nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg" 0)) (PackedTag 3342336) (VArg1 0)) (Ins (Pack (ReferenceDerived (Id "nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg" 0)) (PackedTag 3342337) ZArgs) (Ins (Pack (ReferenceDerived (Id "nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg" 0)) (PackedTag 3342337) ZArgs) (Ins (Pack (ReferenceDerived (Id "fjo76u255o8gt9no3cjhe6n5s2se5aquk3f6eqpehf6db418c1iokkfr8st4g3rqo88dlfbjtcpo7sc650cb499sfk2641lag9tm628" 0)) (PackedTag 5636096) (VArgN (fromListN 6 [4,2,1,0,9,10]))) (Yield (VArg1 0))))))))) ([0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],fromListN 4 [Foreign (Wrap ReferenceBuiltin "Bytes" _),Foreign (Wrap ReferenceBuiltin "Bytes" _),Foreign (Wrap ReferenceBuiltin "Bytes" _),UnboxedTypeTag NatTag])
expected type: ReferenceDerived (Id "fjo76u255o8gt9no3cjhe6n5s2se5aquk3f6eqpehf6db418c1iokkfr8st4g3rqo88dlfbjtcpo7sc650cb499sfk2641lag9tm628" 0)
I’m trying to dig in, but I don’t really know what this is saying the problem is
- why is the closure bad?
- is this closure defined somewhere in my code?
- if so, could some of the
Ids be resolved to names, or other parts of the syntax printed a bit more symbolically?
It’s a little better pretty-printed, but I still don’t recognize anything here:
PAp
(CIx (ReferenceDerived (Id "02btgjevuvmqndr35f6g4sgupu5d1d747esqjrqn7tqlqelj8fkc8" 0)) 635 0)
( LamI
6
11
( Let
( App
False
(Env (CIx (ReferenceDerived (Id "01dfuifohdt991v9qmk3umdc2nv6ugmg8e7m7vsl7jrncsbj16b9m" 0)) 633 0) < RCOMB >)
(VArgN (fromListN 4 [0, 1, 2, 3]))
)
(CIx (ReferenceDerived (Id "02btgjevuvmqndr35f6g4sgupu5d1d747esqjrqn7tqlqelj8fkc8" 0)) 635 1)
11
( Ins
(Lit (MT "3rfcNHYJY1ZVvWVs7j"))
( Ins
( Pack
(ReferenceDerived (Id "nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg" 0))
(PackedTag 3342336)
(VArg1 0)
)
( Ins
( Pack
(ReferenceDerived (Id "nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg" 0))
(PackedTag 3342337)
ZArgs
)
( Ins
( Pack
(ReferenceDerived (Id "nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg" 0))
(PackedTag 3342337)
ZArgs
)
( Ins
( Pack
(ReferenceDerived (Id "fjo76u255o8gt9no3cjhe6n5s2se5aquk3f6eqpehf6db418c1iokkfr8st4g3rqo88dlfbjtcpo7sc650cb499sfk2641lag9tm628" 0))
(PackedTag 5636096)
(VArgN (fromListN 6 [4, 2, 1, 0, 9, 10]))
)
(Yield (VArg1 0))
)
)
)
)
)
)
)
( [0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
fromListN
4
[ Foreign (Wrap ReferenceBuiltin "Bytes" _),
Foreign (Wrap ReferenceBuiltin "Bytes" _),
Foreign (Wrap ReferenceBuiltin "Bytes" _),
UnboxedTypeTag NatTag
]
)
I figured out my particular issue here (I added fields to a record type, and failed to update one of the call sites, so I ended up passing a Foo -> Bar to something expecting a Bar), but so far my attempts to reduce it to a reasonably-sized chunk of code for a transcript quickly result in a normal “got a Foo -> Bar, but expected a Bar” error.
I think it has something to do with my use of existentials.