Category "haskell"

How can I implement Tail Recursion on list in Haskell to generate sublists?

I want to make the biggersort function recall itself recursively on the tail of the list. My code below works and gives me the following output : [6,7,8] I wan

Is it worth adding zeros to rows of uneven number of columns in a list of lists?

I have a working Haskell example of how to do it when we want to add zeros to the left and to the right of a list as two separate functions, and I did it becaus

Power set using BST in haskell

I have implemented a Set datatype in Haskell using Binary search tree. I have not used any of the in-built functions nor imported any module. My set datatype is

What's the number with the biggest Collatz sequence in a range?

I have to write a program using recursion that, given n, returns the minimum value m, 1 ≤ m ≤ n, that generates the longest sequence of Collatz Steps For

How to build llvm-hs from source

I'm working on parsing large llvm-ir code using haskell & llvm-hs for some research work. I used gllvm (comment on this post - Getting LLVM IR for a clang/c

Type level computations on types including type variables

I was working recently with freer and I got inspired to try creating a method that allows composing of arbitrary arity functions using type level computations,

construct a binary tree from string in haskell

how do I construct from string representation of binary tree a binary tree ? I already wrote a function that takes a string representation and converts it to a

Alternative function for case match in haskell

I am writing an API in Haskell which involves a DB query. Function will be something like do a db query and then return the response back. doAPICall :: Request

Positive integer type

In many articles about Haskell they say it allows to make some checks during compile time instead of run time. So, I want to implement the simplest check possib

Why is this memoized Pascal's Triangle recursion not as fast as expected?

Referencing this article on Memoization, I believe that this approach uses memoization, and should be fast. However, it doesn't seem to be the case here: pascal

Monad Transformer with recursion

when I want to load a bmp file I do this with: loadBMP :: String -> IO Picture If it isn't certain if the given path exists one could do something as follow

Haskell Criterion: Could not load module, hidden package

When I do exactly what this Criterion tutorial says to do to get started, I get an error. What am I doing wrong? Is the tutorial wrong? If so, is there a place

How to use Data.Map ! Operator?

I have the following anti-pattern in my code: existsFunc :: Maybe Item -> Item This is part of a larger piece of code that checks if a name is in a Dictiona

List of the Prelude haskell operators, with precedence level

Where can I find a list of the infix Haskell operators in Prelude and base package in general, along with their precedence level, and whether they're right or l

how exactly do expression makes the list comprehension redundant haskell

We know that list comprehensions and do expressions are equivalent for lists. Also list comprehensions are redundant. But can someone explain how exactly do not

How to define overlappable depending instances?

So I have a typeclass somewhat like this class Stringify x where stringify :: x -> String and I have two other typeclasses somewhat like those class LText

Doom Emacs > Haskel > What is the keyboard shortcut to evaluate a code block?

In Doom Emacs, Haskell code snippets placed after -- >>> can be evaluated using the mouse by clicking on the "Evaluate..." link. Is there a keyboard sh

"put together" output through recursion in Haskell

I really don't know how to properly describe my problem. I have an assignment to do and as part of that I need to take a list and return a new list that is an a

Import the * operator of type level naturals

Follow-up to Import a type family that is an operator in Haskell. This works: import GHC.TypeLits (type (+)) This is a parse error in GHC 9.0: import GHC.TypeL

How to test specific hSpec property using `--match` and cabal

I have a bunch of test modules and I can run a specific one using cabal test. cabal test Module.Name.Here The module contains many tests and one of them fails