Member Avatar for Member #1021832

I am trying to install haskell on xubuntu precise for my haskell class and I cant get it to work. I keep getting 'prelude' module is not available and I have spent hours back and forth installing and uninstalling ghc. Can someone please tell me how to get this thing working. :(

Dani AI

Generated

Short summary and practical fix notes drawn from the thread: the “Prelude” error plus the GHC panic reported by normally means the compiler cannot see the core base library or the package database is inconsistent (mixing distro packages, old bindists, or missing “dyn”/profiling variants are common causes). The Prelude module is provided by the base package. (hackage.haskell.org)

Suggested diagnostics (show what the current ghc and package database look like):

which ghc
ghc --version
which runhaskell
ghc-pkg list
ghc-pkg check
uname -m

ghc-pkg list/ghc-pkg check will show missing or broken packages and point at the reason why Prelude isn’t being found. (ghc.gitlab.haskell.org)

If the package DB is broken or the install came from mixed sources, the most reliable cleanup is to remove the distro/bundled Haskell packages and reinstall using the modern toolchain manager GHCup (it installs GHC, cabal/stack and HLS, keeps multiple GHCs side-by-side, and updates PATH). The Haskell Platform is no longer the recommended installer; prefer GHCup for a classroom/dev setup. (haskell.org)

Quick reinstall route (from an unprivileged shell; follow prompts from the installer):

curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
# then use ghcup to install/set ghc and cabal (interactive or ghcup CLI)

Note: building with profiling or dynamic flags sometimes requires the profiling/dynamic variants of base (the error message mentioning profiling/dyn libraries is common); installing via ghcup or using stack/cabal-managed builds avoids most distro-packaging pitfalls. (stackoverflow.com)

Context tie-ins: ’s prompt about how GHC was installed is exactly the right first check, and ’s suggestion to try an online REPL is handy for quick experimentation but does not replace fixing the local toolchain for course work.

Recommended Answers

All 4 Replies

How exactly did you install GHC? Did you install anything Haskell-related other than the main GHC package? And what's the exact error message you're getting?

Member Avatar for Member #1021832

Well I tried:
sudo apt-get install ghc
sudo apt-get install haskell-platform
So I thought well I am in, I make a hello.hs folder and try to compile it and i get

kratos@Scylla:~$ runhaskell /hello.hs
ghc: panic! (the 'impossible' happened)
  (GHC version 7.6.3 for i386-unknown-linux):
    interactiveUI:setBuffering2

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

kratos@Scylla:~$ ghc -o hello hello.hs

Or when I try ghc -o hello hello.hs I get this:

kratos@Scylla:~/Documents$ ghc -o hello hello.hs

hello.hs:1:1:
    Could not find module `Prelude'
    Use -v to see a list of the files searched for.

So the problem seems to be the 'Prelude' module which I am still googling like crazy and cant seem to find it

To get the look and feel of Haskell, I tried it out from my browser see here

Member Avatar for Member #1021832

Ok finally after looking up all the sites i could find on google. I did one thing I deleted xubuntu from Virtual box and I found this website and I managed to install the haskell on my system and managed to compile my first haskell program with a 'printf' and not 'print' and so my first error. Here is the blog:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.