Stream: beginners

Topic: `U8` is a `Int a`, right?


view this post on Zulip Brendan Hansknecht (Jul 09 2024 at 02:13):

This 1st argument to encodeInt has an unexpected type:

77│  encodeU8 = \n -> encodeInt n
                                ^

This n value is a:

    U8

But encodeInt needs its 1st argument to be:

    Int a

Am I missing something here. This should just work, right?

view this post on Zulip Luke Boswell (Jul 09 2024 at 02:27):

Num.intCast might help -- as a workaround

view this post on Zulip Luke Boswell (Jul 09 2024 at 02:28):

But otherwise, it looks like it should be happy taking a U8 if it's expecting a Int a

view this post on Zulip Brendan Hansknecht (Jul 09 2024 at 02:29):

Yeah, seems to be an ability function issue in general.

view this post on Zulip Brendan Hansknecht (Jul 09 2024 at 02:29):

Also breaks with constants

view this post on Zulip Brendan Hansknecht (Jul 09 2024 at 02:29):

maxPosFixInt = 0x7F

Is being limited to being used as one type if used in an ability function when it should be allowed to be used as any int Type

view this post on Zulip Luke Boswell (Jul 09 2024 at 02:31):

Sounds similar to the top-level thunk thing. Like if that constant is a thunk, does it still have an issue?

view this post on Zulip Brendan Hansknecht (Jul 09 2024 at 02:32):

It even has the issue as a thunk

view this post on Zulip Brendan Hansknecht (Jul 09 2024 at 02:32):

I think it is something off with ability specialization that is over constraining types

view this post on Zulip Richard Feldman (Jul 09 2024 at 02:35):

yeah looks like a bug for sure


Last updated: Jul 06 2025 at 12:14 UTC