Got stuck witha Nix package: Haskell, JuicyPixel

Question:

Sorry if this is obvious… I’ve been using Replit for a while, but this is the first time I need to install a Nix package.

I’m trying to get JuicyPixel work in Replit.

content of replit.nix:

{ pkgs }: {
    deps = [
        pkgs.haskellPackages.ghc
        pkgs.haskell-language-server
        pkgs.haskellPackages.JuicyPixels
        pkgs.cowsay
    ];
}

At system dependencies I see Juicypixels as installed.

My Main.hs is so far an empty file with an import:

import Codec.Picture

When I hit “run”, or load Main.hs in ghci, or just try to import Codec.Picture in ghci,
I get the error

Main.hs:1:1: error:
    Could not find module ‘Codec.Picture’
    Locations searched:
      Codec/Picture.hs
      Codec/Picture.lhs
      Codec/Picture.hsig
      Codec/Picture.lhsig

Am I missing a step? Should I add a path somewhere?

Codec.Picture is part of the JuicyPixels package. In my computer, after installing JuicyPixels, I was immediately able to import Codec.Picture, and any other module of JP.

Thanks in advance.

Repl link/Link to where the bug appears:
https://replit.com/@mekispeter/pngproba

Screenshots, links, or other helpful context:
https://replit.com/@mekispeter/pngproba#screenshots/Screenshot1.png

Hey @mekispeter and welcome to the community!

If I am not mistaken, it should be:

import Codec.Picture.hs

Thank you for your answer, and also for the welcoming! :slight_smile:

Unfortunately, this raises a parse error. I’m sure the correct syntax of importing is without file extension. But apparently ghci thinks I want to import a local modul, so although JP is installed, ghc doesn’t know about it.

Hmm…

I found an example for JuicyPixels here, maybe you could fork this Repl and move your files here? (Is the screenshots folder necessary?)

(Their replit.nix file is different to yours, this might be why)

2 Likes

Just what I needed. It works now. Thank you!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.