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

Cabal: Blocking base packages from installing

I'm using cabal-install 1.14.0 on Ubuntu 12.04, and ghc 7.4.1. Some cabal packages I try to install are pulling in directory-1.2.0.0, which requires ghc 7.6. Is there a way to configure cabal to not even attempt to install directory-1.2.0.0?
nnyby
  • 4,748
  • 10
  • 49
  • 105
3
votes
1 answer

Is there a library for detecting which RTS flags are set?

When I run ./MyProgram +RTS -N4 I want my program to automatically detect that it's running on 4 cores and create 4 sparks to process a data set. Right now, I am recompiling every time I want to change this option, which is annoying.
Mike Izbicki
  • 6,286
  • 1
  • 23
  • 53
3
votes
3 answers

Can't load GHC.TypeLits module

Just installed the current Haskell Platform 2012.2.0.0, which says it uses base-4.5.0.0, and base-4.5.0.0 includes the GHC.TypeLits module. However, when I try to load GHC.TypeLits, ghc can't find it: % ghci --version The…
rampion
  • 87,131
  • 49
  • 199
  • 315
3
votes
1 answer

Why can't cabal build mighttpd2 dynamically?

GHC is too slow when it links my executable statically, so I want to test using "-dynamic" options. The following two commands cause the same error although cabal install mighttpd2 is ok. $cabal install --ghc-options=-dynamic mighttpd2 $cabal…
z_axis
  • 8,272
  • 7
  • 41
  • 61
3
votes
1 answer

Determine ModuleName of loaded target

I was wondering how do you determine the ModuleName of the file you've just loaded in ghc using the API. If you look at the Documentation of the API they always assume you know the module name before you load the file in. I have tried top sorting…
Phyx
  • 2,697
  • 1
  • 20
  • 35
3
votes
2 answers

Error when executing "cabal install hoogle"

When I run cabal install hoogle, I get the following: setup: The program happy version >=1.17 is required but it could not be found cabal: Error: some packages failed to install haskell-src-exts-1.13.3 failed during the configure step the exeption…
z_axis
  • 8,272
  • 7
  • 41
  • 61
3
votes
1 answer

Automatically allocate cost centres in GHC

I'm using GHC 7.4.1 and trying to profile a piece of code. Unfortunately, the output of the profiler assigns one big cost centre to the main function, instead of breaking it up into multiple cost centres for each function. This is the procedure I'm…
Chris Taylor
  • 46,912
  • 15
  • 110
  • 154
3
votes
1 answer

Importing Ratio module using ghci

I am learning Haskell and trying to use exact Rational numbers. I have the the following simple Haskell code: import Ratio x :: Rational x = 5 % 2 When I load this in WinHugs, everything is fine. However, when I load it in ghci, I get the…
Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268
3
votes
1 answer

Ambiguous occurrence `Just'

I am an absolute beginner. Going through LYAH using emacs. My current Set up: Ubuntu 12.04 LTS (Use Experience - beginner) GNU Emacs 23 (Use Experience - beginner) able to work in haskell major mode Finding difficult to follow instructions (to…
Optimight
  • 2,989
  • 6
  • 30
  • 48
3
votes
2 answers

Haskell error: cannot derive well-kinded instance / kind-mismatch

I'm having trouble deriving a Typeable1 instance for a date structure in Haskell. This is my code: {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE DeriveDataTypeable #-} import Data.Typeable (Typeable,Typeable1) newtype FooM m a =…
Rob Stewart
  • 1,812
  • 1
  • 12
  • 25
3
votes
0 answers

GHC violates the identity laws?

Possible Duplicate: runST and function composition I've encountered a weird code segment that GHC fails to type-check correctly when composed with id. I'm pretty sure this is a GHC bug, but I wanted to check by here first before filing a bug…
Gabriella Gonzalez
  • 34,863
  • 3
  • 77
  • 135
3
votes
1 answer

c2hs - anonymous enums?

The c2hs reference (aka 'Tutorial') mentions the name of the C enum as a non-optional parameter. Is there any way to get it to work with anonymous enums? Determining which enum to generate should be possible given just a single enum member, or even…
Cubic
  • 14,902
  • 5
  • 47
  • 92
3
votes
3 answers

creating a large Set - need to reduce time spent in GC

This program creates a very large set to find a hash function collision. Is there a way to reduce the amount of time spent in GC? +RTS -s is reporting 40+% time spent in GC. Example usage: ./program 0 1000000 +RTS -s ./program 145168473 10200000…
ErikR
  • 51,541
  • 9
  • 73
  • 124
3
votes
1 answer

GHC - Mac OS X - ld: unknown option: -no_pie

When I try to compile a simple Hello World in Haskell and compile with ghc --make Main.hs I get: Linking Main ... ld: unknown option: -no_pie collect2: ld returned 1 exit status I'm on Mac OS X 10.6.8. I used to be able to compile…
Brandon oubiub
  • 311
  • 1
  • 3
  • 9
3
votes
1 answer

Is it possible to compile "only a file" in a cabal project?

In JVM based programs, you can compile a file to a .class file and be able to run the binary again, without compiling necessarily all the files. Is it possible to do it in haskell? Is it imperative to compile and link all the files in the project?…
Carlos López-Camey
  • 2,504
  • 1
  • 17
  • 20
1 2 3
99
100