Skip to main content
Filter by
Sorted by
Tagged with
4 votes
0 answers
74 views
+100

disjointCollisions :: Eq k => Word -> Array (Leaf k a) -> Word -> Array (Leaf k b) -> Bool I would like this function to be specialized (to arbitrary unknown key types k) but never ...
sjakobi's user avatar
  • 3,598
2 votes
1 answer
64 views

The following program gets the error: "Illegal term-level use of the type constructor or class ‘IOError’" even though it's right out of the source to ghc: {-# LANGUAGE Trustworthy #-} {-# ...
davidg's user avatar
  • 63
4 votes
2 answers
112 views

Problem: Can't avoid a module cycle with class definitions in Haskell. Foo.hs contains: module Foo where import {-# SOURCE #-} Bar class FooClass a where ... myBar :: BarClass -> a -- use a ...
davidg's user avatar
  • 63
1 vote
1 answer
81 views

This question tries to collect the full picture if/when a stale object reference can happen from an old-gen (immutable) array referring a newer-gen object, from fragments of information. Preface: was ...
ron's user avatar
  • 9,458
3 votes
2 answers
107 views

I'm familiar with the SPECIALIZE pragma, or INLINE/INLINABLE that might enable automatic specialization at the use-site. But those are about specializing functions for type variables taking special ...
ron's user avatar
  • 9,458
2 votes
2 answers
103 views

So I have a project in Haskell, and I was using make to build it, but then I switched the project over to use Cabal as someone recommended to me on another Stack Overflow post. It is an FFI project, ...
Jacob Bauer's user avatar
2 votes
1 answer
56 views

I have been making a Haskell project that I want to continue on in C at some point through the FFI. I wanted to create a makefile to compile all the source with Clang for C and GHC for Haskell. The ...
Jacob Bauer's user avatar
7 votes
2 answers
216 views

In Haskell in Depth, Chapter 11, there's an example aimed at avoiding character escaping in GHCi, which is what happens automatically when you enter print "ë", as it'll be printed like "...
Enlico's user avatar
  • 30.3k
7 votes
1 answer
197 views

We are working on some programs that do rewriting logic, where there is a state (often complex), a set of rules that match certain patterns in this state, and strategy for applying these rules to ...
cjs's user avatar
  • 27.9k
2 votes
1 answer
73 views

I would like to create a virtual record field "r" for the red component of a color using the Color package. This package uses a data family Color. I tried to write the following : import GHC....
141592653's user avatar
  • 794
4 votes
1 answer
125 views

Using GHC 9.6.2 and looking at the GHC Core output, I see a lot of break<N>, where N is a small integer. What does this mean? For example, from a source definition: type Store = Map Id Integer ...
cjs's user avatar
  • 27.9k
4 votes
2 answers
120 views

How to understand p r -> t and p t -> r in PFunctor p r t | p r -> t, p t -> r? https://github.com/ekmett/categories/blob/4a02808d28b275f59d9d6c08f0c2d329ee567a97/old/src/Control/...
zichao liu's user avatar
2 votes
1 answer
80 views

In Parallel and Concurrent Programming in Haskell by Simon Marlow, chapter 7 starts at page 125 with this example, import Control.Concurrent import Control.Monad import System.IO main :: IO () main = ...
Enlico's user avatar
  • 30.3k
1 vote
0 answers
47 views

I get following error in VSCode: However, when I run this command in shell manually it works fine: % stack --stack-yaml /home/user/haskell/h5/stack.yaml exec ghc -- --numeric-version 9.8.2 My stack....
LetMeSOThat4U's user avatar
4 votes
2 answers
146 views

Consider the following typeclass for defining equality between values of heterogenous types: class HEq a b where heq :: a -> b -> Bool We can define an instance for Int and Bool as follows: ...
James Burton's user avatar
0 votes
1 answer
83 views

Below are my ghcup config - I've I've created haskell project using stack with command stack new stack-hls-dbg-demo. I then updated snapshot.url as below so that it uses ghc-9.10.1- snapshot: url: ...
user51's user avatar
  • 10.6k
0 votes
1 answer
77 views

Here's a module: module Foo where foo ws = let ws' = take 3 $ ws ++ repeat mempty x = ws' !! 0 y = ws' !! 1 z = ws' !! 2 in [x, y, z] and here's ...
Enlico's user avatar
  • 30.3k
0 votes
1 answer
85 views

I was just trying out some stuff with the ImplicitParams language extension when I typed this code: let ?callStack = undefined in undefined and it caused a compiler panic: panic! (the 'impossible' ...
Holz's user avatar
  • 133
3 votes
1 answer
120 views

In the GHC manual, section 6.4.6 Existentially quantified data constructors, it says (second to last bullet point on the page), “You can’t use existential quantification for newtype declarations.” In ...
Jason Whittle's user avatar
0 votes
0 answers
79 views

Today I used ghcup to automatically installed all haskell tool chains. When I entered ghc -Wall C:\2.hs -fforce-recomp,the response is: [1 of 2] Compiling Main ( C:\\2.hs, C:\\2.o ) clang:...
Hasturnius's user avatar
3 votes
2 answers
103 views

Consider this somewhat silly datatype: type data AllowPrimesOnly = PrimesOnly | AllNumbers data Number (allowPrimesOnly :: AllowPrimesOnly) where One :: Number AllNumbers Two :: Number ...
Clinton's user avatar
  • 23.2k
1 vote
1 answer
997 views

I was trying to setup the Haskell Plugin for VSCode and I had two seperate problems while trying. First: The original error I faced while setting up the Haskell Plugin in VSCode was: HLS does not ...
Hallo5000's user avatar
0 votes
0 answers
54 views

I'd like to get the behavior of -Xmissing-import-lists but exclude record field wildcard imports. Example: $ ghc -XNoImplicitPrelude -Wmissing-import-lists {a,b,c}.hs a.hs: import Prelude (putStrLn, ...
Jan Matejka's user avatar
  • 2,000
4 votes
1 answer
103 views

Let's say I define the following datatype: data fmt :* (n :: Nat) where Rep :: fmt -> fmt :* n Using RequiredTypeArguments, I can define a function that takes the n parameter as a required ...
Cactus's user avatar
  • 27.8k
1 vote
1 answer
42 views

I believe if I make a constructor like: data MyThing = MyThing Word8# Word8# Word8# Word8# GHC (with optimisations turned on) will now pack the unboxed words within one word, instead of ...
Clinton's user avatar
  • 23.2k
1 vote
1 answer
57 views

This is what I have so far: instance Monad Ptr where return = pure (>>=) (Ptr t) f = f t The error being thrown is: • Couldn't match a lifted type with an unlifted type When ...
kesarling's user avatar
  • 2,336
1 vote
1 answer
81 views

I have the following Haskell file that contains a CPP macro. #define FOO( x, y ) x ++ y foo = FOO("a", "b" ++ "c") bar = 1 When I call cpphs on this ...
Jan Christiansen's user avatar
1 vote
1 answer
78 views

I have a program A that internally calls GHC-as-an-API to compile some other Haskell module B. B has external dependencies (incl. compile-time plugins) that are recorded in the .cabal file as ...
Cactus's user avatar
  • 27.8k
4 votes
2 answers
289 views

I’m trying to write a simple Haskell function that distinguishes between an empty list and a non-empty list. Here’s my code: {-# LANGUAGE OverloadedLists, RebindableSyntax #-} import Prelude (Int, IO,...
Vanson Samuel's user avatar
1 vote
1 answer
109 views

In this stackoverflow post there is code in C++ that tries to mimic associated types. When the lambda functions capture the environment(closure) using by reference capture the code compiles but fails ...
Dragno's user avatar
  • 3,134
5 votes
1 answer
281 views

The following Haskell funcion: {-# LANGUAGE ForeignFunctionInterface #-} module Main where import Data.Word (Word32) sum' :: Word32 -> Word32 sum' 0 = 0 sum' n = n + sum' (n-1) foreign export ...
MaiaVictor's user avatar
  • 53.4k
5 votes
1 answer
103 views

The GHC documentation for OverloadedLabels here shows examples like Leading capital letters: #Foo equivalant to getLabel @”Foo” Should getLabel be fromLabel? AFAIK getLabel is for creating unnamed ...
pat's user avatar
  • 12.8k
0 votes
1 answer
76 views

My C: drive was full, so I decided to remove all Haskell snapshots older than two month, knowing it could cause trouble. And it did : ghc-9.8.2.exe: addLibrarySearchPath: \\?\C:\sr\snapshots\d22c45cb\...
141592653's user avatar
  • 794
7 votes
2 answers
278 views

I tend to stick to "recommended" versions: ┌──────────────────────────────────GHCup──────────────────────────────────┐ │ Tool Version Tags Notes ...
Enlico's user avatar
  • 30.3k
2 votes
0 answers
100 views

During a GHC upgrade we noticed one particular test case seemed to just hang forever (at runtime, not compile time). In searching for a looping bottom value lurking somewhere I found a startling fact, ...
jberryman's user avatar
  • 16.7k
2 votes
2 answers
276 views

This is what I see when I run ghcup tui in a terminal in $HOME: ┌──────────────────────────────────GHCup──────────────────────────────────┐ │ Tool Version Tags ...
Enlico's user avatar
  • 30.3k
0 votes
0 answers
34 views

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
271 views

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
  • 30.3k
2 votes
1 answer
152 views

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
  • 594
6 votes
1 answer
281 views

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
72 views

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
123 views

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
110 views

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
116 views

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.8k
1 vote
1 answer
221 views

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
1 answer
277 views

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,775
0 votes
1 answer
379 views

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
120 views

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
  • 30.3k
0 votes
0 answers
134 views

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
135 views

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

1
2 3 4 5
51