2,541 questions
0
votes
0
answers
28
views
Making VSCode + stack respect .ghcup/env
I'm using latest VSCode with Haskell extension. There's a trivial (?) problem of toolchain (GHC, HLS, stack, cabal) being mismatched depending on what process is used to start VSCode (Debian + KDE ...
3
votes
2
answers
137
views
Why doesn't GHC automatically add injectivity annotation to closed type families (provided that insntances don't conflict with it)?
Since closed type families have all their clauses appearing together and therefore can't be extended with other clauses, and since GHC can detect violations of injectivity annotations anyway (even for ...
1
vote
1
answer
102
views
What is the grammar of GADTs and ADTs in GHC2024?
My question comes for the fact that I don't fully understand the nuances of declaring datatypes. I think I get lost in all the degrees of freedom out there: do I use GADT syntax or not? Do I spell out ...
-2
votes
1
answer
148
views
Optimization of entropy-based wordle solver on haskell [closed]
My wordle solver seems to be slow, i would like to ask your opinions on how i can speed it up further
I did some optimizations i could think of, but speed still seems to be bad
As far as i understand, ...
2
votes
0
answers
124
views
Stack for Haskell unable to remove files?
I am a beginner Haskell programmer on Windows 11. I am writing a Snakes & Ladders program, and am attempting to set up a Stack environment to work in.
I have been following this guide, as well as ...
5
votes
2
answers
304
views
Ensuring specialization while preventing inlining
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 ...
2
votes
1
answer
90
views
ghc gives error for something that's allowed in GHC.Internal.System.Posix.Internals
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 #-}
{-# ...
4
votes
2
answers
119
views
GHC can't avoid module cycle with class definitions
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 ...
1
vote
1
answer
90
views
Under what circumstances can a write to a Haskell unsafeThaw-ed array/vector result in a segfault (via lost GC root)?
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 ...
3
votes
2
answers
120
views
Does GHC specialize data constructors, or how to design for such a usecase
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 ...
2
votes
2
answers
132
views
Cabal not recognizing Include/Header File Directories for FFI project
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, ...
2
votes
1
answer
65
views
GHC(Haskell) not picking up imports from makefile
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 ...
7
votes
2
answers
259
views
What is wrong with this closed type family in GHC2021-GHC2024 as compared to Haskell2010?
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 "...
7
votes
1
answer
201
views
Redundant pattern matching slowing down our Haskell program
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 ...
2
votes
1
answer
78
views
GHC.Record : Record data type may not be a data family
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....