Thanks Daniel,

I think we might be mixing up the two threads here, please let me know if I've misunderstood, so I'll respond as if this was in response to the thread about in-memory buffers: the function you've hightlighted is working as intended (thanks for clarifying the API change, I had to work that out myself and was just guessing) and produces the minimal buffer that is then used by the next function.

As to the relation between importsOnly and lookupModule / findModule, they are independent.

On Wed, 26 Feb 2020 at 23:05, Daniel Gröber <dxld@darkboxed.org> wrote:
Hi,

looking at `importsOnly`:

    #if MIN_VERSION_GLASGOW_HASKELL(8,8,1,0)
      pp <- liftIO $ preprocess sess file Nothing Nothing
      let (dflags, tmp) = case pp of
            Left _ -> error $ "preprocessing failed " <> show file
            Right success -> success
    #else

Since 8.8.1 `preprocess` takes an addition argument of type `Maybe
StringBuffer` that you're setting to `Nothing` here, so the pipeline will
read your on-disk file instead of using the buffer.

The whole point of that change was to allow passing in-memory buffers
straight into the pipeline for tooling so I'm hoping you can use that to
simplify your workarounds, see
https://gitlab.haskell.org/ghc/ghc/merge_requests/1014/ for context.

--Daniel

On Wed, Feb 26, 2020 at 09:58:31PM +0000, Tseen She wrote:
> Hi ghc-devs,
>
> When upgrading my dev tool to use the 8.8.x api I have found that calls to
> lookupModule / findModule are failing on uncompilable code, whereas these
> calls succeeded on 8.4 and 8.6.
>
> Unlike another question that I have asked [1] which seems related, I don't
> intend to do any typechecking here, I only want access to the ModuleInfo.
>
> Has this been an intentional change? Is there a way to recover the original
> behaviour?
>
> If I cannot get this to work then it means that a new feature introduced in
> https://gitlab.haskell.org/ghc/ghc/merge_requests/1541 that I was quite
> excited about is unusable :-(
>
> [1] https://mail.haskell.org/pipermail/ghc-devs/2020-February/018655.html

> _______________________________________________
> ghc-devs mailing list
> ghc-devs@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs