Skip to main content
Filter by
Sorted by
Tagged with
1 vote
0 answers
43 views

Why is this Haskell program throwing a type signature error?

I'm new to Haskell (as you can probably see in my code) and I wanted to make a simple Brainf### interpreter: import Text.Read (readMaybe) import Data.Maybe (fromJust) import Data.List (findIndex) ...
Victor PISLARU's user avatar
0 votes
0 answers
16 views

Cabal package reading problem when trying to build a project

So i am trying to set up haskell on my macbook (m1) and i need to use cabal for one project. I installed most of what i needed with homebrew. So when i try to run cabal build in the directory of the ...
gregtsen's user avatar
3 votes
0 answers
41 views

How to Free Resources Allocated During Debugging in GHC or Stack Debugger?

I'm debugging a Haskell program using GHC's debugger (ghci) or via stack ghci, specifically with the Haskell GHCi Debug Adapter (Phoityne extension) in Visual Studio Code, and I'm encountering a major ...
Daniele Caliandro's user avatar
0 votes
0 answers
64 views

Is there anything like Haskell "guarded equations" in modern C++?

I would like to know if there are equivalent to Haskell guarded equations in Modern C++ (C++20, C++23). Here is an example from Richard Bird's Haskell book where guided equations are used: combine2 :: ...
ezyman's user avatar
  • 317
0 votes
1 answer
37 views

What part of the type system is getting in the way, when I try to pass IO action via reader monad transformer instead of via function argument?

Look at this answer from an older question about Testing functions in Haskell that do IO. It proposes, as a solution, to pass IO actions as arguments to a function that doesn't hardcode IO, but just ...
Enlico's user avatar
  • 28.1k
1 vote
0 answers
31 views

How can I unit-test computations that happen in a monadic transformer stack with an IO base layer?

Below is very simplified version of a program I wrote¹, where I have some read-only state (e.g. screen size, etc) made available via ReaderT, and some mutable state (the state of the game) that I ...
Enlico's user avatar
  • 28.1k
1 vote
2 answers
68 views

Indentation of a nested function appears to require at least 5 spaces in haskell

I am trying to learn haskell through the advent of code (I know, it's late in the season), but I am encountering indentation issues I do not understand, despite checking what I believed to be the ...
Xelote's user avatar
  • 55
0 votes
2 answers
82 views

Compute time-to-next-warmest-day in Haskell without using a conversion to-or-from `Data.Map`

Consider the following problem: Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the ...
lanf's user avatar
  • 523
0 votes
0 answers
34 views

Approaches to a `Render` function in functional reactive programming

You have a signal function PointlessButton which inhabits Signal (Maybe Unit) -> ? that represents a button that does nothing, and a rendering function, Render that inhabits ? -> Signal (...
shintuku's user avatar
  • 233
0 votes
0 answers
41 views

Error occured while (re-)installing GHC and setting up the VSCode Haskell Plugin

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

How to exclude field record wildcard imports from ghc -Wmissing-import-lists?

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
  • 1,970
1 vote
0 answers
19 views

How can I suppress the error summary at the bottom of `stack test`

I like to have stack test --file-watch running in a terminal below my editor so when I make a change and save, it reruns my tests and gives feedback. However, in the output below, everything after the ...
Quinn Wilson's user avatar
  • 8,243
4 votes
0 answers
94 views

Is there a way to define `Eq` for this free group implementation (without implementing it twice)?

I have defined a free group type as follows: {-# Language RankNTypes #-} {-# Language ConstraintKinds #-} {-# Language KindSignatures #-} import Data.Kind newtype Free (s :: Type -> Constraint) (...
Wheat Wizard's user avatar
  • 4,114
4 votes
1 answer
64 views

Why can't constructors have required type arguments?

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.6k
0 votes
1 answer
60 views

Are there alternatives to having an idle thread waiting for user input, in gaming?

I've coded a very basic Snake game, and as far as input/output goes, I've taken the following approach: I create an MVar to store the most recent keypress; I use withAsync to spawn two threads, both ...
Enlico's user avatar
  • 28.1k

15 30 50 per page
1
2 3 4 5
3439