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.

learn more… | top users | synonyms

5
votes
1answer
37 views

Fraction or integer parser

Question How can the following implementation of fractionParse be made less ugly? (Preserving unreduced numerators and denominators is supposed to be a feature---...
1
vote
0answers
30 views

Making HTTP request using Haskell wreq

The program makes HTTP requests (checks video stream status) and calls an external program. ...
2
votes
1answer
29 views

Filtered date range function

I want to write a function to produce an inclusive range of Day such that Saturdays are excluded. ...
5
votes
1answer
62 views

Basic Nim game in Haskell

I am starting to learn Haskell, and following Dr. Erik Meijer lectures online, he suggests as an exercise to implement the game of Nim in Haskell, so I implemented a really basic game for two players (...
4
votes
2answers
100 views

I can has(kell) moar cheezburgers?

KITTEH HAS IMPROOVD CODE SKILLS, AN NAO HAS BETTR CODE 4 U This is an improvement of my original Haskell Lolcats Translator, and now features a function to do the translation (recursively?) using a ...
19
votes
4answers
5k views

I can has(kell) cheezburger?

Edit 13 June: I have made a new and improved version here. Original Question This is a very rudimentary lolcats translator (it only works on the phrase "Can I have a cheeseburger") in Haskell. This ...
3
votes
1answer
63 views

Symmetry analysis for atom arrangements in a crystal

For a while now I've been meaning to post some of my Haskell code here so that someone can tell me what parts of the language/base library I've been completely overlooking. This is the first thing I'...
13
votes
3answers
1k views

Using Fibonacci sequence to generate musical melodies

I recently started picking up the Haskell programming language. I've managed to learn other languages rather quickly, but I'm still having a difficult time grasping some of the basics of Haskell. I ...
0
votes
0answers
68 views

New to Haskell | Help me write good code [duplicate]

So I recently started picking up the Haskell programming language. I've managed to learn other language rather quickly, but I'm still having a difficult time grasping some of the basics of Haskell. I ...
0
votes
1answer
39 views

Composing IO and Async in haskell

Whether based on MVar or TVar, async implementation are always based on operation on some underlying monad IO and STM. Making Async a monad on its own, as in F# async computation builder, if done in ...
2
votes
2answers
60 views

Print out a Zig-Zag Matrix in Haskell

My task is to code something that prints out this: This is what I have done so far. ...
-2
votes
1answer
22 views

Capture some state in Haskell

I want to capture some state in a Haskell function. For instance, I have many thread trying to print on the console and I want the to play nice with each other. So I want to have some XX to make the ...
-5
votes
3answers
93 views

Refactor code to be more succinct but yet preserve the distinction of the `if`

the below code does what it needs to do. However I would like to know if there are better (shorter) ways to express the below while maintaining the explicitness of showing the decision like with the ...
3
votes
0answers
69 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 ...
25
votes
1answer
2k views

Charmander Brainfuck interpreter in Haskell

I just started learning Haskell and this is my first big project (ie not factorials, fibonacci or graphers). This is kind of a gift for somebody so the language is a bit different. The program works, ...
4
votes
1answer
43 views

LEB128 in Haskell

I have implemented the LEB128 encoding for unsigned integers. I'm fairly new to Haskell so I have some doubt about the coding style I'm using, particularly the definition of ...
6
votes
4answers
172 views

Get Nth item from end of list

I am starting out in Haskell and thought I would try to make a function that got the index (nth) from the end of the list. So getNthFromEnd 5 [1..10] would equal 5 ...
3
votes
1answer
40 views

Converting images to greyscale using JuicyPixel

I would like to use Haskell to do some image processing so I have been writing small programs to test performance. I wrote a program to batch convert PNG images from color to greyscale. I compared the ...
1
vote
1answer
47 views

Haskell Non-Dominated sorting

This algorithm sorts a list of Individuals, each with two fitness values, into what's called non-dominated fronts. A non-dominated front is a set of individuals where none of the individuals dominate ...
3
votes
0answers
60 views

Over-engineered fizzbuzz

I've got this fizzbuzz project I am using for a blog series, among other things. In this version, the fizzbuzz function is fed from a Fibonacci generator. I'm particularly concerned with the ...
1
vote
0answers
23 views

Implement “at” lens for Data.Map

I've been working on adding an operation like Data.Lens.At.at to Data.Map. This uses an extremely fast, extremely small, and ...
3
votes
2answers
68 views

Convert Roman Numeral to Arabic

I've been learning Haskell recently and I decided I needed to work on a (somewhat) realistic problem. What I'm most interested in getting feedback on is how well I've used the tools in Haskell to ...
1
vote
1answer
65 views

FIRST and FOLLOW sets calculator in Haskell

I found myself wanting to brush up on some notions about parsers and grammars and, at the same time, to exercise my Haskell - I am a Haskell newbie; moreover, I haven't touched the language at all in ...
1
vote
1answer
42 views

Playing with event-sourcing

I'm playing around with some ideas about how to read aggregates from events. From a high-level view I would love to have this: ...
2
votes
0answers
22 views

Unification with sequence variables and flexible arity functions

Today I wrote an implementation of the unification algorithm found in Temur Kutsia's 2002 paper. I didn't just do this for fun, it's related to other research I'm doing. I'm feeling more confident in ...
3
votes
1answer
33 views

Haskell Pig Latin Translator - v2

Thanks to Gurkenglas for the help with the previous iteration: Haskell - Pig Latin Translator! Given the constraint that the newtypes are required, what ...
3
votes
1answer
55 views

Haskell - Pig Latin Translator

What improvements can I make to the following Pig Latin translator? So far, I've been wondering about the FlexibleInstances declaration, but I can't think of how to ...
3
votes
2answers
52 views

Idiomatic Leap years in haskell

I wrote a simple function to determine if a year is a leap year or not. It works, but does not feel idiomatic. ...
7
votes
2answers
110 views

Bucket sort in Haskell

As a first step in learning Haskell I am solving this problem, which involves finding the Rith-ranked numbers, given some input list and many Ri. In an imperative language I would make a zeroed array ...
3
votes
1answer
105 views

Simple Haskell Chess

Just for fun I tried to write a chess game in Haskell, in the hope that it would eventually be good enough to beat me. It's not perfect at the rules (it doesn't know about promotion, castling or en-...
3
votes
1answer
61 views
2
votes
2answers
53 views

Determine whether input-output pairs represent something that could be a proper math function

The input is read in line by line from stdin. Input Format The first line contains an integer, T, denoting the number of test cases. The subsequent lines describe T test cases, and the ...
2
votes
2answers
57 views

U2 puzzle in Haskell

Here is a puzzle: U2 has a concert that starts in 17 minutes and they must all cross a bridge to get there. All four men begin on the same side of the bridge. You must help them across to the ...
6
votes
1answer
78 views

Data structure for expression evaluation in Haskell

I've made a data structure for mathematical expressions. I want to parse mathematical expressions like: \$x = 3\$ \$y = 4\$ \$z = x + y :\$ into an evaluated document like: \$x = 3\$ \$y = 4\$ \$...
5
votes
1answer
55 views

`read` re-implemented for Int's

I have written a safe read function for haskell (for education!). I think this is fairly idiomatic haskell code, but I'd like to know for sure. If you see anything else that could be improved, please ...
4
votes
3answers
63 views

Check whether a string contains exactly one distinct vowel

Over on Stack Overflow, someone asked a simple Haskell question: how to test whether there is exactly one distinct vowel in a given string. To clarify, there can be any number of non-vowel characters, ...
7
votes
3answers
123 views

Prolog parser written in Haskell

I am writing a very simple Prolog intepreter in Haskell. It's a class assignment and I really want to do it right. I was able to (quite quickly) write a parser for the language. Today I borrowed a ...
4
votes
3answers
66 views

Filtering triangles

I'm playing with Haskell's list comprehensions, tuples, and foldr. The exercise I've given myself is to find all triangles with a perimeter of length 26 in the set ...
9
votes
5answers
249 views

Pizza Hut math problem #1 in Haskell

I'm currently attempting to learn Haskell after a fair history of imperative programming. When I saw the Pizza Hut Pi Day math problems, I thought the first one would be a good candidate for my ...
8
votes
2answers
707 views

Conversion of a simple Python Neural Network to a Haskell implementation

I started with this code and modified and expanded it in Python. As an exercise/challenge to myself I decided to covert the original to Haskell. I either write imperatively or functionally. This is ...
4
votes
1answer
570 views

Memoized Collatz sequence

Here is one of my programs that utilized memoization and array to improve performance and memory usage. The performance seems satisfactory but the memory usage is ridiculous and I can't figure out ...
4
votes
3answers
80 views

Math eval function for Haskell

I recently finished reading Learn you a Haskell for great good!. Even though some topics are a bit over my head (Monads anyone?), I wanted to try my hand at a ...
2
votes
0answers
32 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,...
1
vote
1answer
49 views

Mapping and sorting lists of Haskell tuples

I'm a newbie with Haskell and I'm trying to learn the language and its idioms while working through a small data analysis project. The first step of my analysis is to take a very long list of data, ...
2
votes
2answers
102 views

Fizz Buzz in Haskell

Pretty straightforward, I implemented the popular fizz buzz challenge in Haskell. ...
4
votes
2answers
71 views

Convert oOo to Brainfuck and vice-versa

This program was inspired by a Code Golf challenge that I wanted to do properly. It simply converts oOo to Brainfuck and vice-versa. The oOo language basically uses UPPER / lower case information in ...
1
vote
1answer
24 views

Haskell union list implementation pt 2

This is my revision from another post ...
3
votes
1answer
64 views

List union implementation

I'm trying to implement union from the standard Data.List library. I know it's reinventing the wheel, but reimplementing ...
2
votes
1answer
76 views

List of tuples generated through list comprehension

The function returns a list of tuples which is generated through list comprehension: ...
1
vote
0answers
42 views

Expression parser in Haskell using operator precedence table

This is my first non-trivial Haskell project, an expression parser implemented using the Pratt Parser's technique for managing precedence as a layer on top of Parsec. It simply builds an expression ...