I guess you can't always use crash and put in a todo when abilities are involved:
── TYPE MISMATCH in MsgPack.roc ────────────────────────────────────────────────
This specialization of i16 is overly general:
55│ encodeI16 = \_ -> crash "todo"
^^^^^^^^^
This value is a declared specialization of type:
* -> *
But the type annotation on i16 says it must match:
I16 ->
FutureEncode.FutureEncoder state where state implements FutureEncode.FutureEncoderFormatting
Note: The specialized type is too general, and does not provide a
concrete type where a type variable is bound to an ability.
Specializations can only be made for concrete types. If you have a
generic implementation for this value, perhaps you don't need an
ability?
Tip: Type comparisons between an opaque type are only ever equal if
both types are the same opaque type. Did you mean to create an opaque
type by wrapping it? If I have an opaque type Age := U32 I can create
an instance of this opaque type by doing @Age 23.
hm yeah I'm not sure if that's avoidable :thinking:
Luckily, roc is happy turning function prototypes into runtime errors:
encodeI16 : I16 -> FutureEncoder MsgPack
# No definition
ha, nice!
Trying to make sure that my gist on the new encoders is correct
hm, if that's the case, I'm kinda surprised it accepts one but not the other :thinking:
Yeah, probably should be printing out a warning with taht
it's probably a bug that it just emits a runtime error and no warning
@Ayaz Hafiz might know why this works :sweat_smile:
I guess it's because in the annotated version it's a less general type
but it's still surprising to me that it works
yes, that's why
the annotation forces the type
Last updated: Jul 06 2025 at 12:14 UTC