Questions tagged [ghc]

Glasgow Haskell Compiler is a state-of-the-art, open source compiler and interactive environment for the functional language Haskell. Use this tag for questions specifically about GHC and not about Haskell in general as almost everyone will be using it unless specified otherwise.

The Glasgow Haskell Compiler (GHC) is the most commonly used compiler for . Apart from supporting the language standards (Haskell 98 and Haskell 2010), it also supports a wide variety of language extensions like generalized algebraic data types (GADTs) and multi-parameter type classes.

As GHC is by far the most used Haskell compiler, it is safe to assume that anyone is using it unless specified otherwise. This means the GHC tag should be used for questions relating directly to the compiler or to its APIs, and not for questions about Haskell in general.

GHC also exports most of its functionality as a Haskell API - the compiler itself can also act like a library. This tag should also be used for any questions pertaining to the GHC API.

Other resources:

2470 questions
3
votes
1 answer

Updating all packages in GHC global package db to latest versions

I am trying to install the latest versions of all the Hackage packages that I use, and I would like to update the packages that ship with GHC 7.6.3 (except maybe for the base package) to their latest versions. Is there an easy way to do this? If…
Rouan van Dalen
  • 748
  • 4
  • 14
3
votes
1 answer

is this a bug of 32bit GHC on MAC

To make long stroy short, my code is about parse a json file using aeson Here is my two pieces of code: a.hs {-# LANGUAGE OverloadedStrings #-} import Data.Aeson import qualified Data.ByteString.Lazy.Char8 as C import Control.Monad import…
sray
  • 93
  • 1
  • 9
3
votes
1 answer

How do I compile only certain modules with '-auto' cost centers?

I am profiling a program using ghc's option -fprof option to automatically create cost centers. The profiling output would be easier to understand if I only had cost centers from particular modules. Compiling everything first as ghc --make…
Ein
  • 1,553
  • 3
  • 15
  • 22
3
votes
2 answers

What does cabal's "Warning: Falling back to topdown solver for GHC < 7." mean?

When building with cabal on GHC6 it warns: Warning: Falling back to topdown solver for GHC < 7. What's the topdown solver and what is the meaning of the warning? How does it affect me?
Petr
  • 62,528
  • 13
  • 153
  • 317
3
votes
1 answer

What does the `-O99` flag do?

The title is a slight joke. I just discovered today that ghc accepts any optimization level without complaining. I know that -O2 is supposed to be the maximum optimization level, and that there is a proposed -O3 here, but I was just curious what…
Gabriella Gonzalez
  • 34,863
  • 3
  • 77
  • 135
3
votes
1 answer

How to write a comparator chaining function?

I'm trying to write a function that accepts a list of comparators and returns a comparator that will compare a pair of values using the first comparator, then the second one if the first comparator returned EQ etc. What I came up with was the…
Alexandros
  • 3,044
  • 1
  • 23
  • 37
3
votes
2 answers

Ambiguous type in functional dependency

In the haskell functonal dependency wiki: Given these definitions: data Vector = Vector Int Int deriving (Eq, Show) data Matrix = Matrix Vector Vector deriving (Eq, Show) instance Num Vector where Vector a1 b1 + Vector a2 b2 = Vector (a1+a2)…
wliao
  • 1,416
  • 11
  • 18
3
votes
1 answer

Reregister existing package with ghc-pkg

I have previously installed a package with cabal install . And I have unregistered it using ghc-pkg unregister. But now I want it back again. The package binaries and source are still stored in my .cabal directory. I just need to register…
Lii
  • 11,553
  • 8
  • 64
  • 88
3
votes
1 answer

Treating a String as a Haskell Program

As a small part of a larger University project, I need to write what is essentially an extremely crude IDE. The idea is to to take input from a gtk text box, treat that string as if it is in a .hs file, and evaluate a function within it. My main…
Craig Innes
  • 1,573
  • 11
  • 23
3
votes
1 answer

How to get an offline Haskell debug trace?

In the Haskell docs here http://www.haskell.org/haskellwiki/Debugging it mentions Hat to do offline debug traces, but that page is online. I found it via Google but it seems outdated; what is the best way to do offline Haskell traces?
CharlesS
  • 1,563
  • 2
  • 18
  • 31
3
votes
2 answers

Compiling in GHC

I'm learning Haskell and a simple doubt struck me, what is the difference between these two commands to compile using GHC (fac is a program to calculate factorial) : ghc -o fac fac.hs and ghc fac.hs Now to run the program I just do fac.exe (I'm…
user1493813
  • 981
  • 1
  • 8
  • 16
3
votes
1 answer

Haskell GHCI not loading compiled object file

I would like GHCI to load the compiled object code for a module which when compiled is significantly faster than the none compiled version. This was working well when all of the files were in the same directory (no module hierarchies). However, they…
Joe
  • 1,534
  • 9
  • 19
3
votes
0 answers

Haskell on iOS with current xcode

I am having trouble getting Haskell up and running on iOS using the GHC-ios github projects. What is the most reliable method to get GHC configured with xcode for ios?
eigen_enthused
  • 525
  • 6
  • 17
3
votes
2 answers

liftM vs. raw replicate

replicate 3 "hi" produces ["hi", "hi", "hi"] but liftM (replicate 3) "hi" produces ["hhh", "iii"] How the liftM operates (precisely)?
Cartesius00
  • 23,584
  • 43
  • 124
  • 195
3
votes
2 answers

Haskell, Hackage, GHC and productivity. How to solve a real example?

I don't know the best way to solve a simple (probably) problems (hackage related). I asked for help about it (http://stackoverflow.com/questions/12841599/haskell-hackage-ghc-and-productivity-what-to-do) but I knew not explain well. Today, I'm with a…
josejuan
  • 9,338
  • 24
  • 31