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.

88 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
23 votes
0 answers
398 views

Mucheck - a mutation analysis tool for Haskell programs

We have been working on a mutation analysis tool for Haskell tests called MuCheck. It accepts any Haskell source file, and a function name to mutate, applies a defined set of mutation operators on it, ...
Rahul Gopinath's user avatar
16 votes
0 answers
3k views

Realtime concurrent Haskell MIDI buffer

Problem Background MIDI is a serial representation of control signals to a sound generator. Typically, a noteOn message initiates the attack phase of a sound at a given pitch. The note will ...
user1441998's user avatar
7 votes
0 answers
83 views

Feedback on LZSS implementation

Recently, I've been trying to get back into Haskell, so I tried coding up a LZSS implementation. I realize this is much more easily implemented imperatively, but I wanted to challenge myself. The last ...
greenjaed's user avatar
  • 171
7 votes
1 answer
154 views

BingWallpapers: Fetches and applies the image of the day from Bing as the wallpaper

I have written a small desktop program nabeelomer/BingWallpapers in Haskell. This is my first time writing Haskell. I was wondering how I can make the code use more functional programming features/...
1 -_-'s user avatar
  • 71
6 votes
0 answers
79 views

FRP: Processing task lists

I recently heard about functional reactive programming and thought it was rather interesting. Therefore, I started out with writing a simple program which processes a list of tasks. (In this example, ...
APlessner's user avatar
6 votes
0 answers
639 views

Website using Persistent, Blaze-html, and Scotty

I know that my let configFilePath = Prelude.head args is unsafe and was wondering how I could handle it better. My deployment almost always has a file at ...
codygman's user avatar
  • 161
6 votes
0 answers
446 views

Implementing recursive filters with Haskell/Repa

I recently learned Haskell, and I am trying to apply it to the code I use in order to get a feeling for the language. I really like the Repa library since I manipulate a lot of multi-dimensional data....
Xīcò's user avatar
  • 161
5 votes
0 answers
54 views

Compute a Working Capital Loan

This code takes a list of EBITDA amounts (for a hypothetical business), and computes a loan that would fund that business with working capital in periods of loss. When the business has positive EBITDA ...
lbseale's user avatar
  • 51
5 votes
0 answers
260 views

Yet another implementation of Conway's Game of life in Haskell

(Sorry for my bad English) Hi, I'm interested in getting feedback of my own implementation of Conway's Game of Life. Some details: Uses gloss for animation Uses rio for shorter dependency list My ...
smb374's user avatar
  • 51
5 votes
0 answers
417 views

Roman numerals in Haskell

I have written a module that provides some functions for dealing with Roman numerals. I would like some feedback concerning my style, potential performance or elegance improvements, and any ...
castle-bravo's user avatar
5 votes
0 answers
389 views

Tic Tac Toe in Haskell

After reviewing many Tic-Tac-Toe implementations, I decided to write my own. Here it is: Logic.hs ...
Spike's user avatar
  • 1,423
5 votes
0 answers
447 views

Persistent segment tree

I'm trying to solve this problem. Given a sequence \$B=B_0,B_1,\ldots,B_{N−1}\$ for each query \$(P,K)\$, find the minimum \$S\$ s.t. there are at least \$K\$ entries in \$B\$ that satisfies ...
johnchen902's user avatar
5 votes
1 answer
170 views

GitHub API client

Here is my Haskell program designed to list all of my GitHub repos along with their descriptions and languages via the GitHub JSON APIs: ...
Richard Cook's user avatar
4 votes
0 answers
1k views

A simple chess engine in Haskell

This is my first Haskell project so I don't really have a good feel for what makes Haskell code clean, so they'll be lots of things that can be improved. Things I have a gut feeling are bad design: ...
L292092's user avatar
  • 419
4 votes
0 answers
390 views

Kattis Ants challenge

I am trying to learn Haskell doing some contest problems. I have worked a bit with the language but still have a very long way ahead. Right now I am working with a problem called Ants: An army of ...
A. Lindberg's user avatar
4 votes
0 answers
66 views

Functional blob counting

I have image files consisting of black and white pixels encoded as RGB8. I want to count the number of blobs i.e. contiguous areas of white pixels. I rewrote this algorithm in haskell. The algorithm ...
user2740's user avatar
  • 409
4 votes
0 answers
214 views

Implementation of the Hindley-Milner type system (with evaluation, without type inference) as a library for use in compilers

I've written an implementation of the Hindley-Milner type system as a "Core" language for use in writing compilers of typed functional languages. This is meant to be used as a library by compilers of ...
DylanSp's user avatar
  • 203
4 votes
0 answers
1k views

Snake in Haskell with Ncurses

I've created the Snake implementation in Haskell. User input and graphic is handled by the Ncurses library. The goal of this question is to get the feedback on what can I improve to make it more ...
Piotr Aleksander Chmielowski's user avatar
4 votes
0 answers
801 views

Sound recorder, based on sdl2

This is my first Haskell program, a command-line sdl-based(so, hopefully, cross-platform), parameter-less sound recorder. Tutorials, articles or chapters that concern mistakes in my code are just as ...
Vorac's user avatar
  • 454
4 votes
0 answers
128 views

Code Generation with Template Haskell

Background: Recently, I've been working through Coroutining Folds with Hyperfunctions. Don't bail out now if the whole thing makes little sense - it's just the motivation for the existence of my code,...
Carl's user avatar
  • 336
4 votes
0 answers
274 views

Using recursion schemes to avoid explicit corecursive unfolding

The code is self-contained and self-explaining. I want to improve the goal function. You can change everything below the ...
nponeccop's user avatar
  • 1,084
4 votes
0 answers
115 views

Implementing insertAt for both [a] and [(i,a)] lists

I've implemented generic insertAt function which inserts element into both indexed and ...
user avatar
4 votes
0 answers
94 views

Existential Types and IO

In my attempts to grasp Existential Types in Haskell I decided to implement an integer-based fixed-length vector data type. I'm using ghc 7.8.3. Specifically I wanted to write a program which asks ...
Cristiano Paris's user avatar
4 votes
0 answers
159 views

Splitting and Joining Machines

A small program I use as my "hello world" of streaming libraries is the following: For each line of stdin Interpret the line as a file-name If the file represented ...
Lyndon Maydwell's user avatar
4 votes
0 answers
784 views

Binomial Heap in Haskell

Here's a partial binomial heap implementation in Haskell (just merge and insert): ...
Inaimathi's user avatar
  • 2,193
4 votes
0 answers
352 views

A short KenKen solver

I'm new to Haskell and I've made a very short KenKen solver. Any input is welcome. ...
Owen's user avatar
  • 41
3 votes
0 answers
188 views

Advent of Code 2021, Day 3 in Haskell

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
3 votes
0 answers
121 views

Performance issue regarding Project Euler #60 in Scheme

I solved Project Euler #60: The primes 3, 7, 109, and 673, are quite remarkable. By taking any two primes and concatenating them in any order the result will always be prime. For example, taking 7 ...
Jay Lee's user avatar
  • 151
3 votes
0 answers
74 views

Haskell test performance for different container types

I want to test the performance for various types of containers in Haskell. So far I got Vector and List. My goal is to learn how to use typeclass, how to use containers etc. Could anyone point out ...
daydaynatation's user avatar
3 votes
0 answers
80 views

Solution for Gophercises Quiz game in Haskell

Here is my solution for the Quiz game exercise from https://gophercises.com/. The goal is to write a program that will read questions and their correct answers from a CSV file, ask them from a user ...
Aleksei Tirman's user avatar
3 votes
0 answers
79 views

How to simplify the following distance function for the taxicab ring metric space?

Consider the taxicab ring metric space shown below. This is a discrete metric space in which we have both a grid and concentric diamond rings. This metric space stretches infinitely in all four ...
Aadit M Shah's user avatar
3 votes
0 answers
95 views

Unique Distancing Problem, Memoization in Haskell

note: You might be scared seeing the length of the post, but it's actually not that long because you don't need to read the compiler logs or the python code to understand my code (I wish StackExchange ...
Benoît P's user avatar
  • 799
3 votes
0 answers
57 views

Finding the least number of terms to satisfy integer square equation

The following code is a solution to an exercise I've made: This exercise idea is based on a story from my current work place: My boss'es Ubuntu had a bug that made his printer, when asked to print ...
sshine's user avatar
  • 741
3 votes
0 answers
375 views

Fast Hamming sequence generation in Haskell

I found some months ago that I could generate Hamming multiples of 3 and 5 multiples (3^x & 5^x) in one list comprehension. There are many fewer 3 and 5 Hamming multiples in a Hamming sequence. I ...
fp_mora's user avatar
  • 209
3 votes
0 answers
133 views

Vocabulary memory game in Haskell

As a beginner I try to implement a vokable memory game. It is still missing some feature (Loading, Display), but I would like to hear how to improve what is already there. The user should identify ...
Drei's user avatar
  • 31
3 votes
0 answers
239 views

Haskell Laplace determinant

I have written a code in Haskell that calculates the determinant of a matrix using the laplace expansion. As I have just started learning Haskell, I would like some opinions on how well (structured) ...
Fabian Schneider's user avatar
3 votes
0 answers
464 views

Converting English words to numbers in Haskell

A few weeks ago, I finished a number to word converter and received an excellent review. It caused me to make several fundamental changes to numToWord, such as ...
BrainFRZ's user avatar
  • 819
3 votes
0 answers
341 views

Game of Life in Haskell with Nested Zippers, Comonads, etc

I was trying to implement Game of Life in Haskell. Here is my approach: ...
Agnishom Chattopadhyay's user avatar
3 votes
0 answers
200 views

Sudoku solver in Haskell using Reader+ST

While trying to understand monad transformers in Haskell I came up with a sudoku solver based on a combination of the ST and Reader monad. I am positively surprised with the performance, however ...
curious's user avatar
  • 31
3 votes
0 answers
98 views

Flexible port scanner library

I have tried to generalize the concept of turning an IP address into a boolean. The save format is an overly complicated way of storing consecutive IP addresses as strings of bits Example usage: <...
BlackCap's user avatar
  • 361
3 votes
0 answers
271 views

Naive implementation of Naive Bayes in Haskell

A simple implementation of Naive Bayes, as I'm a Haskell beginner I've tried to put an emphasis on clarity and documentation. I've tried to incorporate the feedback from a similar question. This is ...
dimid's user avatar
  • 303
3 votes
0 answers
1k views

Lambda calculus interpreter in Haskell

This code is a representation of lambda calculus using an AST instead of text. ...
stephenwebber's user avatar
3 votes
0 answers
939 views

AVL Tree Implementation in Haskell

I'd like to get some feedback on my AVL tree implementation. I appreciate any comments related to style and performance, particularly if something can be written in a more concise or idiomatic way. If ...
castle-bravo's user avatar
3 votes
0 answers
257 views

Zipper trees implementation

Considering the lack of general purpose library to manipulate trees (not to mention zipper ones), I may end up packaging this piece of code, so I would like it to be reviewed first. Any comment is ...
koral's user avatar
  • 131
3 votes
0 answers
413 views

Haskell s-expression parser and quasiquoter

There are a number of questions on this site about s-expression parsing: e.g., Calculator parsing S-expressions and Code from "Write Yourself a Scheme in 48 Hours" tutorial. However, these ...
wchargin's user avatar
  • 1,169
3 votes
0 answers
108 views

Generation and parsing of English numerals (cardinal and ordinal)

I need to use the English numerals (American) in Haskell, so I looked for a library that did it. I have not found one, therefore I developed the program that I am presenting here. There are actually ...
Alberto Capitani's user avatar
3 votes
0 answers
331 views

GTK application in Haskell

I'm new to both GTK and Haskell, so I'd appreciate any in both. I'm making an application which for the purposes of this question is just drawing a window that shows a red circle getting larger until ...
VF1's user avatar
  • 131
3 votes
0 answers
64 views

2 4 tree insert function

I'm after creating an insert function for a 2 4 tree in Haskell. I'm just wondering if this is the best way to implement it (especially when handling the Root4s), ...
user3125335's user avatar
3 votes
0 answers
66 views

URL fetcher and parser for XML feeds

Here is a program that will parse and print XML feed URLs. I want to reuse most of it to add post date to each link. This adds a new concern of CLI and output formatting on top of parsing and (poor) ...
sevo's user avatar
  • 291
3 votes
0 answers
997 views

Novice implementation of TicTacToe in Haskell

I want to learn Haskell and figured the best way to do it is to write a simple TicTacToe implementation. However the result feels very inelegant and I think it might be the best playground for your ...
greole's user avatar
  • 131