Skip to main content
0 votes
0 answers
51 views

HLS Server Crashes with VSCode, Linux

I am trying to use VSCode and haskell, I have the following versions of each tool: cabal: 3.12.1.0 stack: 3.3.1 ghc: 9.4.8 hls: 2.10.0.0 The problem is project ...
Milkski's user avatar
1 vote
3 answers
136 views

In the context of STM, what does a transaction log conceptually look like, and how does it evolve when the transaction succeeds after a few retries?

For instance consider this function, that could be used in a WM to allow moving a window from one desktop to another on a given display, moveWindowSTM :: Display -> Window -> Desktop -> ...
Enlico's user avatar
  • 28.9k
3 votes
1 answer
62 views

How do let and case differ in terms of lazyness?

How do let and case differ in terms of lazyness? Where do I find the information myself? And how do I experiment with it in ghci? Some context This incomplete piece of code is an excerpt from Parallel ...
Enlico's user avatar
  • 28.9k
1 vote
1 answer
67 views

Combination of group and take with Data.List.NonEmpty

I'm refactoring a program by changing [a] to (NonEmpty a) so as to avoid having to checks cases of empty lists, which simplifies a lot of my code. In the old code, at one point I transformed a list as ...
composerMike's user avatar
  • 1,138
2 votes
1 answer
66 views

How can GHC's fairness guarantee not show up if a thread is descheduled while it is not holding the MVar?

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
  • 28.9k
1 vote
2 answers
66 views

Clarification on the importance of the immutability of the state inside an MVar in the context of concurrency

In Parallel and Concurrent Programming in Haskell by Simon Marlow, at pages 133 and 134 the following code is shown: type Name = String type PhoneNumber = String type PhoneBook = Map Name ...
Enlico's user avatar
  • 28.9k
2 votes
1 answer
99 views

Why should bracket's first argument perform at most one blocking operation?

In Parallel and Concurrent Programming in Haskell by Simon Marlow, the implementation of bracket is shown, bracket :: IO a -- ^ computation to run first (\"acquire resource\")...
Enlico's user avatar
  • 28.9k
3 votes
3 answers
105 views

Does throw behave the same as throwIO, if instantiated as IO a?

I'm reading Parallel and Concurrent Programming in Haskell by Simon Marlow, and I initially read this suggestion fairly lightly, It is always better to use throwIO rather than throw in the IO monad ...
Enlico's user avatar
  • 28.9k
-1 votes
0 answers
37 views

How can I get my nix package to build using the method defined in `oneTarget`

I have an example repo demonstrating the problem. From the repo's README.md Need help making packages The problem I'm having is making packages the way I would like. In horizon-platoform-template/...
Michael Litchard's user avatar
4 votes
1 answer
123 views

In Haskell, why toRational (1/0) == infinity is False?

I couldn't find documentation for this behaviour and it looks like a bug ([Edit] it is indeed : gitlab.haskell.org/ghc/ghc/-/issues/10387). Am I missing something ? In GHCi : > import GHC.Real ...
141592653's user avatar
  • 764
1 vote
1 answer
119 views

Finding bracketings of an expression

I'm trying to find all possible bracketing of an associative operation. There's only one possibility for n=2 variables: (a + b) ∘ | +--------+ | | a b For n=3, there are 2 ...
J...S's user avatar
  • 5,247
4 votes
2 answers
78 views

find and replace with the haskell package Text.RE.TDFA

I'm attempting to replace numbers in a string with twice their value using Haskell's Text.RE.TDFA package. My current approach: s *=~/ fmap (\x -> show $ 2.0*(read x::Double)) [ed|${doublestring}([...
C. Ding's user avatar
  • 183
2 votes
2 answers
83 views

Illegal functional dependencies using the natural type,

data Zero = Zero data Succ x = Succ x class NatToPeano a b | a -> b where toPean :: b instance NatToPeano 0 Zero where toPean = Zero instance (NatToPeano (x-1) a) => NatToPeano x (Succ ...
Ashok Kimmel's user avatar
3 votes
1 answer
91 views

How to generate HMAC in Haskell Crypton, like with openssl HMAC?

Using Haskell crypton package, I'm trying to generate the same output as openssl dgst but can't figure out what I'm doing wrong. Please help. openssl dgst: $ echo "TheMessage" | openssl dgst ...
Sergiu Starciuc's user avatar
3 votes
1 answer
60 views

Unresponsive ghci terminal [duplicate]

I read variables are immutable in haskell and something like the following does not work in haskell. x = 30 x = x+1 But I still tried this to see what the compiler returns and I got the following : ...
Akash Arjun's user avatar

15 30 50 per page
1
2 3 4 5
3447
X