Skip to main content

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.

ghc
0 votes
0 answers
21 views

Compiling project errors within a docker container targeting linux/amd64

I've been developing a side project (a small web app). I'm developing on a Macbook M1 Pro, however, I need to compile it to test against a linux/amd64 environment. I'm trying to use docker for that. I ...
bitmaybewise's user avatar
3 votes
0 answers
86 views

Can I compile on Linux and target Windows?

Yes, in principle the present question is a duplicate of this one, but that's been asked and answered 12 years ago. The answer might have changed in the meanwhile. And indeed the material I linked to ...
Enlico's user avatar
  • 26.7k
2 votes
1 answer
74 views

Is there a way to set command line options at the top of a Haskell file?

I have some Haskell source files with which I interact with and I was wondering: Is there a way to set command line options at the top of the file? I refer to GHCi command line options that we use ...
NickS1's user avatar
  • 584
6 votes
1 answer
114 views

How "auto lift" is implemented in Haskell?

I'm new to Haskell and learning about Monad Transformer. I found that lift can be omitted when operating on an inner monad in a monad stack. For example: type Foo = ReaderT String (WriterT String ...
Xiangzhi Liu's user avatar
2 votes
1 answer
51 views

How to promote value into type with withKnownNat

I found functions withKnownNat and withSomeSNat in GHC.TypeNats. According to their signatures it is possible to apply function to a dynamic type parameter. If it is not possible then the purpose of ...
Daniil Iaitskov's user avatar
5 votes
2 answers
95 views

Why does nullary constructors in GHC Haskell take two machine words?

I experimented with the closureSize# primitive in GHC. Here I define the helper function I use (x is forced using a bang pattern, so what I am measuring should be the data constructor closures ...
Ruifeng Xie's user avatar
1 vote
1 answer
56 views

How to define Generic instance manually?

It is assumed that instances of GHC.Generic class for data types should be generated automatically by GHC via deriving mechanism, but it is not working for row-types and anonymous records with ...
Daniil Iaitskov's user avatar
5 votes
1 answer
72 views

Rewrite rules with typeclass constraints

There's been a couple of previous questions about rewrite rules that have typeclass constraints, but they seem to involve higher-rank polymorphism. Here, I have a much more "vanilla" ...
Cactus's user avatar
  • 27.5k
1 vote
1 answer
79 views

How do I create a GHC package environment file that's equivalent to not having one?

When using GHC without a package environment file, you'll be able to use several libraries that it ships with, such as containers and text. When you do have a package environment, though, you can only ...
Joseph Sible-Reinstate Monica's user avatar
0 votes
0 answers
58 views

GHC libraries with FFI on Windows have "foreign export" symbols missing

I have the following Haskell source, from which I would like to compile a static library that can be linked into a C program: {-# LANGUAGE ForeignFunctionInterface #-} module Lib where printHello :: ...
Viktor Csimma's user avatar
0 votes
1 answer
95 views

How to use GHC’s `ReadPrec`?

The documentation for GHC.Read describes readPrec only by: Proposed replacement for readsPrec using new-style parsers (GHC only). Other functions, types, etc. have no documentation at all. How do I ...
Bolpat's user avatar
  • 1,626
0 votes
1 answer
165 views

Homebrew error when installing GHC: linker does not have option `-no_fixup_chains`

I was trying to install GHC with homebrew (since Xcode require MacOS 13.5 and up but I'm still on 10.15). The installation error is as follows: ... ==> ./configure --prefix=/private/tmp/ghc-...
Nana Tatsudaki's user avatar
3 votes
1 answer
81 views

Why does Cabal, unlike GHC, not automatically enable GeneralizedNewtypeDeriving if I explicitly enabled DerivingStrategies?

From the documentation I'm inclined to think that if I enable the DerivingStrategies extension, I don't need to enable GeneralizedNewtypeDeriving or DeriveAnyClass, nor any other extension that I ...
Enlico's user avatar
  • 26.7k
0 votes
0 answers
107 views

Understanding and Optimizing Generational Garbage Collection in Haskell

When a program initializes, the mutator allocates memory space for new small objects in the nursery. The nursery serves as a buffer to maintain recently created objects. If these objects remain alive ...
Min Thuta Shein's user avatar
0 votes
2 answers
82 views

Run cleanup function in multiple Haskell child threads when POSIX Signal sent (SIGTERM etc)

TL;DR - how do I make the following work in Haskell: Send a SIGTERM to a long-running program with many active threads (each working on a job) Get all child threads run a cleanup function (updating ...
colophonemes's user avatar

15 30 50 per page
1
2 3 4 5
167