Skip to main content

Questions tagged [haskell]

Haskell is a purely functional programming language, featuring static typing, lazy evaluation, and monadic effects. The primary implementation is GHC, a high-performance compiler with a runtime supporting many forms of parallelism and concurrency.

Filter by
Sorted by
Tagged with
0 votes
0 answers
55 views

haskeline is a reimplementation in haskell of the GNU Readline library (the one that by default allows you to delete the word you just typed on your shell's command line by pressing Ctrl+w, for ...
Enlico's user avatar
  • 531
5 votes
1 answer
503 views

upd: I am very sorry about my mistake. The old version of data is download from luogu, but the website do NOT allow me to download the data of the worst case. In fact, when facing same amount of ...
Haowen Shi's user avatar
3 votes
2 answers
198 views

This is part 2 of Day 4 of 2024's AoC: The problem is as follows: It's an X-MAS puzzle in which you're supposed to find two MAS in the shape of an X. One way to achieve that is like this: ...
Lozminda's user avatar
  • 153
1 vote
0 answers
96 views

As part of a larger project, we're using type-level strings to identify "parties" (synonymously, "locations"). Critical to the system is the ability to express and enforce ...
ShapeOfMatter's user avatar
5 votes
3 answers
310 views

The question asked is very straight-forward and is simple enough to solve. What I am looking for is that hopefully I can get some understanding for using the constructs and built-ins of the Haskell ...
tijko's user avatar
  • 782
4 votes
1 answer
108 views

I've been learning some Haskell as an amateur (to be precise: I started programming with this language, and it has been a year or less since I started seriously). So far, I have realised only small ...
user665110's user avatar
8 votes
1 answer
147 views

I want to get better at functional programming so I started with this simple 2-player TicTacToe game. Next I want to add a simple min-max algorithm to make it a 1-player game, but before that I'd like ...
Peter's user avatar
  • 183
3 votes
1 answer
109 views

The following code parses a 2D Cartesian coordinate passed as Cart2Pol <x> <y> and prints the coordinate in ...
Miles's user avatar
  • 133
2 votes
0 answers
88 views

A previous solution of this code has been posted on Code Review before. This solution is more complicated then that one, but more performant (see the below) Why is this another Question instead of a ...
WesAtWork's user avatar
  • 171
4 votes
1 answer
227 views

Background Saw this problem on TheJobOverflow which seems to be a LeetCode question. It bothered me that the "challenge" of this problem was to recognize the need for a specific data-type (...
WesAtWork's user avatar
  • 171
1 vote
1 answer
239 views

Very new in Haskell, as a first easy program I went for an old algorithm of mine to approximate pi by counting points within a circle. The snippet below is what I could get working. I had quite an ...
Tsaras's user avatar
  • 157
4 votes
1 answer
139 views

I am quite new to Haskell, and this problem is from dailycodingproblem.com: Implement an autocomplete system. That is, given a query string s and a set of all ...
Fin H's user avatar
  • 43
4 votes
2 answers
780 views

I have this code, which is a pseudo-Sieve of Eratosthenes for generating primes: ...
Ari Fordsham's user avatar
3 votes
1 answer
133 views

I am working on a Haskell problem from exercism, which is a learn-to-code website. The problem statement is as follows. Write a function to solve alphametics puzzles. Alphametics is a puzzle where ...
Brendan Langfield's user avatar
5 votes
1 answer
185 views

I'm quite new to Monads and I tried add function call counting to the Ackermann function code. The goal was simplicity, not performance. I want to have code review on the ...
Arpad Horvath's user avatar
2 votes
1 answer
174 views

I have written a tic-tac-toe game in Haskell and was wondering if anyone could provide any hints on how it could be improved ...
Dean Menezes's user avatar
2 votes
1 answer
167 views

This is the No of Island code challenge. Please review my implementation in Haskell. I know there must be some better way of doing this. Given an m x n 2D binary grid grid which represents a map of '...
presci's user avatar
  • 259
3 votes
3 answers
149 views

Here is my attempt to write the infamous factorial using Data.IORef. ...
nponeccop's user avatar
  • 1,104
2 votes
2 answers
132 views

I'm working on the famous clump finding problem to learn Haskell. Part of the problem involve breaking nucleotide sequences, called kmers, into subsequences as follows: ...
plaffont's user avatar
2 votes
1 answer
552 views

I am implementing a function that receives a list of list integers and updates the list appending to the ith element a number x, for example: ...
dpalma's user avatar
  • 165
4 votes
1 answer
269 views

Two Sum Problem: Given an array of integers A and an integer K return True if there are two elements two elements xi, xj (i != j) such that xi + xj = K. Return False otherwise. I am implementing the ...
dpalma's user avatar
  • 165
2 votes
2 answers
111 views

Background I'm building a lisp-like toy language in Haskell with the following (stripped down) AST: ...
mingmingrr's user avatar
0 votes
1 answer
164 views

Let's say you have a simple pure function that applies a discount of 30% if the total price of a list of Items is over 30.00 (let's not delve into the fact that I'm ...
Jir's user avatar
  • 201
4 votes
1 answer
106 views

I was recently tasked with creating a function that could generate a "varied" version of some collection of parameters. As in, it should take in a list of parameters, and then vary the value ...
horriblehaskell's user avatar
2 votes
1 answer
108 views

Context Chapter 6 of Learn You A Haskell contains a function called chain, which outputs the Collatz sequence of a given input. (In short, it takes a natural number....
Jessica's user avatar
  • 910
1 vote
1 answer
87 views

...
Pierre Abbat's user avatar
2 votes
0 answers
119 views

I'm trying to use this library in my haskell program to generate a source map file, but getting some performance issue. The size of the mapping file generated was about 30M bytes, and it took almost ...
freedomhero's user avatar
1 vote
1 answer
201 views

The following function executes each action from the list until a predicate returns True. I have a feeling that this function can be rewritten using ...
Aleksei Tirman's user avatar
2 votes
1 answer
164 views

Intro I have been learning haskell and functional programming using random Project Euler problems. Currently, I have solved Problem 11. What is the greatest product of four adjacent numbers in the ...
Naitik Mundra's user avatar
2 votes
2 answers
507 views

I teach a data structures and algorithms course. Students can choose C++ or Java. As an exercise for myself, I am doing the assignments in Haskell. My primary goal is to understand what aspects of my ...
Jeremy Wright's user avatar
3 votes
1 answer
151 views

I've recently tried to write my functions by using composition. But this one, renderCross' is especially difficult to convert fully. How would I write this ...
ola_bandola's user avatar
1 vote
1 answer
173 views

I recently made a simple hangman game in Haskell but soon wanted to explore the state monad, since it could possibly simplify the code. The result was this (see below), which is exactly 30% more lines ...
ola_bandola's user avatar
3 votes
1 answer
183 views

I just finished a course of functional programming in uni and continued to study Haskell because I found it very interesting! I made a simple hangman game and would like to hear any of your thoughts ...
ola_bandola's user avatar
6 votes
2 answers
932 views

I've been learning Haskell for 2 weeks now which is I'm very new to it. I would like to have feedback on what is good/bad about my code and how it could I improve in learning functional programming ...
JHV's user avatar
  • 63
2 votes
1 answer
180 views

As a beginner exercise, I made small manual lexer that recognizes three types of inputs: integers: /[-]?[0-9]+/ strings, inside double quotes, with backslash ...
Pierre Arlaud's user avatar
3 votes
2 answers
502 views

I am new to Haskell and took it upon myself to make a simple generic list-splitting (e.g. string-splitting) function: ...
Ethan McTague's user avatar
1 vote
1 answer
113 views

I won't restate the problem in full, but in a nutshell you have to parse a file with a "direction" and a "magnitude", for instance: ...
Jir's user avatar
  • 201
4 votes
1 answer
923 views

I'm using Haskell to interpret a dynamically-typed language. I have a sum type called Value which can represent some basic objects: ...
pxeger's user avatar
  • 143
3 votes
1 answer
163 views

I've tried to solve a challenge posted on a LinkedIn forum using Haskell - a language I'm still learning the basics of - and, while the code works correctly, I would like to get some feedback on the ...
Jir's user avatar
  • 201
1 vote
1 answer
146 views

Please review the manacher algorithm in haskell. Find the longest Palindrome in a String. ...
presci's user avatar
  • 259
5 votes
1 answer
354 views

I am currently studying an online course in Haskell and there are no "model examples" of the assignments after finishing them. I'm slowly getting the hang of this, but I'd like some feedback ...
Apelli's user avatar
  • 87
2 votes
1 answer
147 views

Here is my attempt at Advent of Code Day 4 using Haskell. A file contains list of number in first line. And subsequent lines have the bingo Cards ...
presci's user avatar
  • 259
2 votes
0 answers
92 views

Is this a correct implementation in Haskell of a proof checker for first order logic with equality? I am most interested in if it is correct, and if the functions can be made clearer. I would like it ...
user695931's user avatar
2 votes
1 answer
201 views

I am beginner to Haskell. Here is my solution to Advent of Code 2021 Day 3. Let me know what you think. I was looking at the transpose function and decided not to use head & tail function. Given ...
presci's user avatar
  • 259
2 votes
1 answer
98 views

I'm learning Haskell and even though I have experience with Functional Programming the Typesystem has been a challenge. I did this yesterday (after like 2 days) and I would like to know whether this ...
Aguxez's user avatar
  • 167
5 votes
1 answer
531 views

I've written this code in Haskell to convert a number into its written form. It feels ok but at the same time I feel like it can probably be improved on a lot. I would appreciate help in improving it. ...
noatbfgtxa's user avatar
3 votes
1 answer
296 views

I'm trying to calculate perfect powers to solve this code wars challenge: https://www.codewars.com/kata/55f4e56315a375c1ed000159/haskell The number 81 has a special property, a certain power of the ...
jdkleuver's user avatar
3 votes
0 answers
208 views

This is a working solution to today's Advent of Code puzzle, written in Haskell. However, I feel like this solution is not optimal. ...
Scriptim's user avatar
  • 131
8 votes
1 answer
617 views

There are already many Tic Tac Toe posts. But as far as I can tell, none of the ones in Haskell are complete with a GUI Here is my implementation with Gloss. Gist Link for convenience ...
Agnishom Chattopadhyay's user avatar
4 votes
1 answer
1k views

I am learning Haskell and I implemented a recursive function that generates possible strings by length and array (e.g. ['a'..'z']): ...
Vlad Havriuk's user avatar

1
2 3 4 5
22