51,839 questions
Score of 1
1 answer
157 views
How do I run Haskell with ghcid in Vim terminal (i.e. not Neovim, GVim, ...)?
I've tried with the vim-ghcid-quickfix plugin for running Haskell from within Vim, even if looks a bit unmaintained, given last commit is 6 years old.
I have installed ghcid¹, and it's on the path.
...
Score of 0
1 answer
93 views
Why do I have to hit enter twice to evaluate a list comprehension with a local let in GHCi?
If I enter [ x | y <- [1..3], let x = (1, y) ] in ghci, in the sense of typing it and the pressing Enter, I have to hit Enter again to get it evaluated, as the first Enter seems to start a multi-...
Score of 1
2 answers
110 views
Lazy IO and concurrency in Haskell
Suppose that two values are being queried with lazy IO, and now they are passed to a pure function f. Suppose also, that IO action, which queries them, requires waiting for external resource. I ask if ...
Score of 1
1 answer
131 views
Is it possible to generate a reversed list of reversed permutations of a list?
The Data.List implementation of permutations is productive on infinite lists, but when you call it with a finite list, the result is not lexicographic ordered - in case you passed a sorted list to the ...
Score of 3
1 answer
137 views
How do I turn an algorithm accepting a total function into an algorithm that accepts a function returning Maybe and that returns itself Maybe?
As a simple example, consider sortBy :: (a -> a -> Ordering) -> [a] -> [a].
Assume that I'm in a scenario where the as are not a total-order, and that when any two entries of the input [a] ...
Score of 0
0 answers
231 views
co-log: ambiguous type variable from a use of `withLog`
Why doesn't this work, and how can I fix it? I'm confused..
TestWithLog.hs:11:27: error: [GHC-39999]
• Ambiguous type variable ‘msg0’ arising from a use of ‘withLog’
prevents the constraint ...
Score of 0
0 answers
89 views
OpenGL with GLFW code (with haskell bindings) inside WSL2 with NIXOS results in a segfault if taking input form terminal
So im messing around with the haskell bindings to OpenGL and GLFW inside NIXOS for WSL2. I have a very simple program right here that simply initializes GLFW and a window, runs getChar, and then quits ...
Score of 0
1 answer
148 views
When is a 'rigid type variable' not rigid?
Definitions of 'rigid' tyvar have varied a bit over time. The critical requirement is the tyvar appears in a user-supplied signature:
Instead of “user-specified type”, we use the briefer term rigid ...
Score of 0
1 answer
168 views
couldn't use haskell-language-server-9.14.1 with nix
I want to use nix to haskell development. I want to use haskell ghc version - 9.14.1 and haskell-language-server. Here is my toolchain settings -
{
"haskell.toolchain" : {
"hls&...
Score of 0
1 answer
159 views
Methods as higher ordered functions
In other words, methods are not "looked up" at runtime but are simply passed as higher-order functions.
Quote from A Gentle Introduction to Haskell
Learning Haskell coming from Rust, to me ...
Score of 3
2 answers
120 views
Use stack to build executable of a package dependency
The project on working on has a dependency in bitbucket. I've specified it as a dependency in the .cabal file, and it's location in the stack.yaml file. The dependency package has an executable that-...
Score of 0
2 answers
142 views
I cannot install cuda haskell package on WSL2
I am trying to install cuda package via:
cabal install cuda-0.12.8.0
and I get following error:
$ cabal install cuda-0.12.8.0
Resolving dependencies...
Build profile: -w ghc-9.6.7 -O1
In order, the ...
Score of 0
2 answers
175 views
Optional logging with a writer monad in haskell
Let's suppose we have;
fun :: Writer Log a
which produces a and Log is a type of log which is accumulated throughout the computation.
I want this logging to be optional.
class Monoid w => Loggable ...
Score of 0
0 answers
85 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 ...
Score of 1
1 answer
130 views
Warning "Defaulting the type variable `a0' to type `Integer'"
Code:
module Main where
main :: IO ()
main = topLevel
topLevel = putStrLn $ "Hello World!" ++ (show 3)
Generally on the internet they write that when you want to convert Integer to String ...