Skip to content

hie-bios fails to compile where "stack repl" succeeds, even with hie.yaml: cradle: stack: #4492

Open
@kenton-waters

Description

@kenton-waters

Summary

I am trying to get a minimal example of LiquidHaskell working with HLS, and I'm running into the following issue:

The haskell-language-server-wrapper command produces an inappropriate compilation error:

Unknown type constructor `Pos`
    matchTyCon: Pos

The stack repl command, on the other hand, compiles successfully without producing the error (this is the correct behavior, as the code itself is correct).

hie-bios produces the error despite the project containing a hie.yaml file with these contents:

cradle:
  stack:

My understanding was that this was supposed to make hie-bios build "the same way" that Stack does. Why might hie-bios build differently than Stack, even when the hie.yaml file is present?

Steps to re-create

Platform: Arch Linux

Install the following via ghcup:

  • HLS 2.6.0.0
  • GHC 9.8.1
  • Stack 3.1.1
  • cabal 3.12.1

Example project: git clone https://github.com/ucsd-progsys/lh-plugin-demo.git

Replace the contents of the stack.yaml file with the following:

resolver: nightly-2024-01-26

system-ghc: true

packages:
  - .
extra-deps:
  - rest-rewrite-0.4.3
  - smtlib-backends-0.3
  - smtlib-backends-process-0.3
  - store-0.7.18
  - store-core-0.4.4.7
  - liquidhaskell-0.9.8.1
  - liquidhaskell-boot-0.9.8.1
  - liquid-fixpoint-0.9.6.3
  - liquid-prelude-0.9.2.8.1@rev:1
  - liquid-vector-0.13.1.0.1

nix:
  packages: [cacert, git, hostname, z3]

Create a top-level hie.yaml file with the following contents:

cradle:
  stack:

Replace the contents of src/Demo/Client.hs with the following:

{-# OPTIONS_GHC -fplugin=LiquidHaskell #-}
module Demo.Client where
import Demo.Lib

{-@ posId :: Pos -> Pos @-}
posId :: Int -> Int
posId = id

At this point,

stack build compiles with no errors.

stack ghci compiles with no errors.

stack repl compiles with no errors.

haskell-language-server-wrapper produces a compilation error:

Unknown type constructor `Pos`
    matchTyCon: Pos

Why might hie-bios build differently than Stack, even when the hie.yaml file is present? Thank you in advance for your help!

Extra context

I was able to recreate this issue with ghcid.

The command ghcid fails to compile with the same error that hie-bios is producing.

The command ghcid "--command=stack ghci" compiles with no errors, giving the All good message. This does not immediately help me resolve the issue with hie-bios, though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    build tool: stackcomponent: ghcidetype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions