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

How to improve the zipWith's performance in Haskell

I've written a code for Clustering with Data.Clustering.Hierarchical, but it's slow. I tried profiling and changing some of the code, but I don't know why zipWith is taking so many time? (even if, I change list to vector.) import…
Julian.zhang
  • 709
  • 1
  • 7
  • 11
3
votes
0 answers

Core dump upon invoking newForeignPtr

The following program : {-# LANGUAGE ForeignFunctionInterface #-} module Main where import qualified Data.Vector.Storable as S import Data.Vector.Storable.Internal import Foreign.ForeignPtr import Foreign.Marshal.Alloc main = do let (fp,_,_) =…
artella
  • 5,068
  • 4
  • 27
  • 35
3
votes
1 answer

Error building GHC on Windows

While attempting to bootstrap Haskell on Windows without the Haskell Platform I ran into the following error C:\git\Haskell\ghc\libraries\haskeline\dist-install\build/libHShaskeline-0.7.1.2.a: could not read symbols: Archive has no index; run…
Guvante
  • 18,775
  • 1
  • 33
  • 64
3
votes
1 answer

ghci configuration - haskell - Error while changing ~/.ghci file

I was trying to pu my GHCi pretty using this: http://www.reddit.com/r/haskell/comments/144biy/pretty_output_in_ghci_howto_in_comments/ But while runnig GHCi this error appear and I cannot apply the colour changes. user@pcname:~$ ghci GHCi, version…
magamig
  • 414
  • 4
  • 14
3
votes
4 answers

Can you use special syntax for custom data types, as in lists?

List is allegedly defined as something like: data List a = Null | Cons a (List a), But it has special syntax as we all know. I can see how : is just an alias for the Cons type constructor, but 1) how/where is this syntax implemented and 2) can I…
asg0451
  • 493
  • 4
  • 13
3
votes
1 answer

Exporting CPP Macros

I'm hacking around with someone else's code. They have several macros defined in a .h file (no code, just macros), and these macros are used in several Haskell files. What I'm missing is the step which allows this compilation. When I try to compile…
crockeea
  • 21,651
  • 10
  • 48
  • 101
3
votes
0 answers

Haskell FFI stack size with a C++ shared library

I am trying to send a very large amount of data, on the order of several Gigabytes to Haskell via a shared library. Everything seems to work fine up to a point, but I eventually get the error: Stack space overflow: current size 8388608 bytes. Use…
3
votes
2 answers

GADT and explicit forall on ghc 7.8.2

I'm playing with GADTs and explicit forall on ghc 7.8.2. Let's look at the following simple example: {-# LANGUAGE GADTs, RankNTypes #-} data T1 a where T1 :: (b -> a) -> b -> T1 a data T2 a where T2 :: forall b. (b -> a) -> b -> T2 a Here…
projedi
  • 186
  • 6
3
votes
0 answers

Converting single-instance class to function

I wrote some toy code to demonstrate my problem: {-# LANGUAGE DataKinds, PolyKinds, UndecidableInstances, ScopedTypeVariables, FlexibleInstances, TypeFamilies #-} import…
crockeea
  • 21,651
  • 10
  • 48
  • 101
3
votes
1 answer

Pandoc failed to compile on GHC 7.8.2

I tried to install Pandoc on GHC-7.8.2, Fedora 19 and got problem with zip-archive package. zip-archive-0.2.2.1 failed during the building phase. The exception was: ExitFailure 1 So I get last one from github, and tried to install it from sources…
sigrlami
  • 1,822
  • 1
  • 17
  • 35
3
votes
0 answers

Understanding a surprising GHC optimization of Haskell code

I was hacking around with some old Haskell code and stumbled upon a surprising optimization. After a little profiling I noticed the runtime spent a fair amount of time in the following function: divisorCount = product . map ((+1).snd) .…
recursion.ninja
  • 5,377
  • 7
  • 46
  • 78
3
votes
1 answer

Why does GHC 7.8 need dynamic libraries?

GHC 7.8 is now dynamically linked by default. The FAQ says that this requires GHC to also load dynamic objects instead of static objects. Now my question is: Why is this the case? Why can't GHC continue to load static objects, why does it matter how…
bennofs
  • 11,873
  • 1
  • 38
  • 62
3
votes
1 answer

Failed installing dependencies with cabal

I am trying to install the dependencies for a project but I am running into this error: Failed to install base-unicode-symbols-0.2.2.4 cabal: Error: some packages failed to install: base-unicode-symbols-0.2.2.4 failed during the final install…
James Lovejoy
  • 73
  • 1
  • 6
3
votes
0 answers

-XIncoherentInstances doesn't work

I've been messing around with the syntactic library (version 2.0 on github), and I have a small example that causes GHC(i) 7.6.2 to complain about IncoherentInstances. {-# LANGUAGE FlexibleInstances,…
crockeea
  • 21,651
  • 10
  • 48
  • 101
3
votes
2 answers

ambiguity error with `reads` in ghc-7.8

I am testing the code for Write yourself a Scheme in 48 hours with GHC-7.8.2, which gives me an error about ambiguity that I don't recall encountering in previous versions of GHC. The excerpt is below, with the problem line marked: data LispVal =…
thor
  • 21,418
  • 31
  • 87
  • 173