• John@mastodon.social
    link
    fedilink
    arrow-up
    2
    ·
    3 months ago

    @Windex007 @snowe

    Yes. Type-inference typically *knows better than me* what the types should be.

    I frequently ask the compiler what code I need to write next by leaving a gap in my implementation and letting the compiler spit out the type of the missing section.

      • John@mastodon.social
        link
        fedilink
        arrow-up
        0
        ·
        3 months ago

        @Windex007

        lexer :: Parser LexState (Vector Int, Vector Token)
        lexer = do
        (positions, tokens) <- _ nextPositionedToken

        What goes where the underscore is in the above snippet?

        • Windex007@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          3 months ago

          I’ve never used Haskell, so I can barely read this as-is.

          But sure: I have no idea, and I expect that’s your point.

          You as the writer, you don’t know either? What if I could understand Haskell, is there an option to communicate that information to me? Or is the argument that nobody but the compiler and god need know? That having an awareness of the types has no value?

          • John@mastodon.social
            link
            fedilink
            arrow-up
            0
            ·
            3 months ago

            @Windex007
            > You as the writer, you don’t know either?
            Not until the compiler tells me.

            > Or is the argument that nobody but the compiler and god need know? That having an awareness of the types has no value?
            No, I want to know, because knowing the types has value. If the compiler has inference, it can tell me, if not, it can’t.

            • Windex007@lemmy.world
              link
              fedilink
              arrow-up
              1
              ·
              3 months ago

              I recognize that truly functional languages are their own beasts, with tons of amazing features provided by a ton of academic backing.

              I will absolutely concede that I can’t speak to them with a shred of competence. I don’t know about the trade-offs and relative value propositions for pretty much anything in that space, let alone specifically w/ explicit typing.