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

Generating correct link dependencies for GHC and Makefile style builds

I have a Haskell project where a number of executables are produced from mostly the same modules. I'm using a Makefile to enable parallel builds, and it very nearly works the way I want. Here's a stripped down version of my current Makefile, with…
Sami Liedes
  • 1,084
  • 8
  • 19
3
votes
1 answer

Using the GHC API to do a "dry run" of code compilation

I'm working on a fairly simple text-editor for Haskell, and I'd like to be able to highlight static errors in code when the user hits "check." Is there a way to use the GHC-API to do a "dry-run" of compiling a haskell file without actually compiling…
jmite
  • 8,171
  • 6
  • 40
  • 81
3
votes
1 answer

What is the type of Haskell's bind function?

A very popular monad explanation is here: http://blog.sigfpe.com/2007/04/trivial-monad.html I get everything but the part: bind :: (a -> W b) -> (W a -> W b) bind f (W x) = f x I have a basic knowledge of Haskell (haven't used it for a long time),…
Parobay
  • 2,549
  • 3
  • 24
  • 36
3
votes
2 answers

Universal type tranformer in Haskell

Logically, it's possible to define universal transformation function, that can transform from any type to any type. The possible way is: {-#LANGUAGE MultiParamTypeClasses #-} {-#LANGUAGE FlexibleInstances #-} class FromTo a b where fromTo::…
Anon Imous
  • 415
  • 2
  • 11
3
votes
0 answers

Converting Prelude as defined in ghc sources, to readable format as outlined in Haskell 98 Report

In Standard Prelude the definition of the Prelude module is given : module Prelude ( module PreludeList, module PreludeText, module PreludeIO, Bool(False, True), Maybe(Nothing, Just), .... In the ghc sources, it seems that the…
artella
  • 5,068
  • 4
  • 27
  • 35
3
votes
0 answers

GHC Targeting Multiple Platforms

Maybe I'm missing something, but the GHC docs on cross compilation are not very explicit. http://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling Any good examples out there on cross compiling with GHC? I'm currently attempting to build on Mac…
pyrospade
  • 7,870
  • 4
  • 36
  • 52
3
votes
1 answer

I updated ghc to a new version, how do I automatically reinstall all cabal packages?

For instance, I've just updated ghc from 7.6.2 to 7.6.3 and would like just reinstall all the packages I had previously installed.
miguel.negrao
  • 949
  • 5
  • 13
3
votes
2 answers

How do I use GHC.Exts.breakpoint?

The GHC.Exts package exports breakpoint and breakpointCond. Does anyone know how to use these functions? From their names I guess they would allow me to set up permanent GHCi breakpoints, but when I add them to my program nothing happens. For…
ntc2
  • 11,203
  • 7
  • 53
  • 70
3
votes
1 answer

Compiling large data structures in Haskell

I have a CSV file with stock trading history, its size is 70 megabytes. I want to run my program on it, but do not want to wait for 30 seconds every start. 1. Just translate CSV file into Haskell source file like this: From |…
3
votes
3 answers

Is there an optimization similar to loop unroll for functional programming?

Disclaimer: I know little about ghc compiling pipeline, but I hope to learn some more about it with this post, for example, if comparing imperative vs functional is relevant to code compilation. As you know, loop unrolling reduces the number of…
MdxBhmt
  • 1,310
  • 8
  • 16
3
votes
1 answer

could the wikipedia "Reconfigurable computing" code example be solve in adcanced compilers like Haskell?

Article here http://en.wikipedia.org/wiki/Reconfigurable_computing#Example_of_a_streaming_model_of_computation Example of a streaming model of computation Problem: We are given 2 character arrays of length 256: A[] and B[]. We need to compute the…
est
  • 11,429
  • 14
  • 70
  • 118
3
votes
1 answer

Haskell Dependency Conflict

I've been trying to start writing a web app in Scotty, but I'm getting a dependency conflict when I try to run the server. Here's my code: {-# LANGUAGE OverloadedStrings #-} module Site where import Web.Scotty import Control.Monad.IO.Class import…
nahiluhmot
  • 33
  • 3
3
votes
2 answers

'idiomatic' Haskell type inequality

(edited from previous question where I thought code below doesn't work) I wish to implement a haskell function f that has a restriction such that its 2 parameters must not have the same type. I have used the following code: {-# LANGUAGE…
tohava
  • 5,344
  • 1
  • 25
  • 47
3
votes
2 answers

is GHC's implementation of Haskell semantically broken?

I noticed something interesting this morning that I wanted to ask about to see if it is in anyway significant. So in Haskell, undefined Semantically subsumes non-termination. So it should be impossible to have a function isUndefined :: a -> Bool as…
3
votes
1 answer

New GHC feature - did I imagine it?

I swear I saw a new feature in a recent set of GHC release notes - but now I can find no reference to it. Am I delusional, or does this feature actually exist? It was to do with loading incomplete modules. As best as I can remember, it allows you to…
MathematicalOrchid
  • 61,854
  • 19
  • 123
  • 220