• demesisx@infosec.pub
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    1 year ago

    Thank you!

    When you say Haskell and Rust have a similar feature, do you mean how Haskell compiles down to Haskell Core? Can you provide a tiny bit more detail on that point? I adore Haskell.

    • armchair_progamerOPM
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      1 year ago

      Yes. Unfortunately I’m not very familiar with GHC and HLS internals.

      What I do know is that when GHC is invoked with a certain flag, as it compiles each Haskell file, it generates a .hie file with intermediate data which can be used by IDEs. So HLS (and maybe JetBrains Haskell) works by invoking GHC to parse and type-check the active haskell file, and then queries the .hie file to get diagnostics, symbol lookups, and completions. There’s also a program called hiedb which can query .hie files on the command line.

      Rust’s language server is completely different (salsa.rs). The common detail is that both of them have LLVM IR, but also higher-level IRs, and the compiler passes information in the higher-level IRs to IDEs for completions/lookups/diagnostics/etc. (in Haskell via the generated .hie files)