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.

60 questions
Filter by
Sorted by
Tagged with
3k 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, ...
1k views

### Calculating Luhn-algorithm checksum digit

Today I decided to learn some basic Haskell, and for starters I made a program for calculating the checksum of a Swedish personal identification number. It uses the Luhn-algorithm, aka. ...
3k views

Are there any ways which I could improve and simplify this code? Is my code idiomatic Haskell? Is the use of a lens library to change an element of a two-dimensional array unnecessary? If so, how ...
420 views

### UPenn Homework 3: skips function

I've started learning Haskell by following along the CIS 194 Course from UPenn. In the first lessons there is talk about wholemeal programming and certain ways idiomatic Haskell code looks like. Now, ...
3k views

### Implementing nub (distinct)

I've implemented the following nub' or "give distinct elements of list" function: ...
669 views

### FizzBuzz up to 99 in Haskell

This code solves the problem of FizzBuzz. Is it possible in any way to improve it? ...
431 views

...
48 views

### Searching a Join List for an index Attempt #2

Originally I posted this incorrect attempt - Searching a Join List for an index. Given a JoinList: ...
72 views

### Retrieve annotation from a tree annotated with a Monoid

Working on this homework from 2013 for self-learning. For the following Algebraic Data Type: ...
191 views

This is a follow-up question of this one: Tic Tac Toe game in Haskell I have revised my code. How does it look now? ...
564 views

### UPenn CIS 194 Homework 1: Validating credit card numbers

I am working through UPenn CIS 194: Introduction to Haskell (Spring 2013). Since I am not able to take the course for real I am asking for CR (feedback) as it could be from teacher in that course. ...
102 views

### Haskell Brainf*ck interpreter: runtime error handling

I have designed a Brainf*ck interpreter in Haskell. I would appreciate the code review, especially any tips related to error handling (e.g. parsing errors, runtime errors, etc.). ...
594 views

### Naive Bayes classifier

I just started learning Haskell, and I must say it is unlike anything else. As my first not-entirely-trivial piece of code I tried to write a simple Bayes Classifier. It is in two parts, a classifier ...
1k views

### Code from “Write Yourself a Scheme in 48 Hours” tutorial

I recently went through this Haskell tutorial. I'd be interested in any thoughts or comments at all, in terms of improving the structure, order, haskell conventions, or that long, kind of ugly eval ...
1k views

### Optimizing unboxed array operations in Haskell

Consider this simplified code which successively permutes array elements: ...
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 ...
1k views

### Am I thinking functionally in these simple Haskell functions?

I'm learning Haskell using the University of Pennsylvania's online materials. I'm a few lessons in and was looking for some feedback about whether I'm thinking functionally enough or porting over my ...
250 views

### Log messages parser

I've been studying Haskell for some time, but I have never used it for real. So, I started following the CIS 194 Course from UPenn. I resolved the second homework but I'm not fully satisfied with the ...
105 views

### First SO chat message in Haskell followup

I have wrote an application which asks for the user id, and returns a link to the first available chat message: Output Enter user id: 322395 Fetching data... http://chat.stackoverflow.com/...
2k views

### Poker hand identifier

Inspired by this post (along with a number of other people by the looks of it), I created a poker hand identifier with a very similar format. Note that the syntax of the hands is a little different to ...
1k views

### Create Binary, Balanced Tree

I wrote a function, which takes a list of Integers, and then makes a balanced binary tree. Please critique it. I'd like to know know how to make it more concise and idiomatic. ...
168 views

### Interactive Brainfuck interpreter in Haskell

Last week I started learning Haskell, and since I have some experience with Brainfuck already, I decided it would be a great idea to implement an interactive Brainfuck interpreter in Haskell. I'll ...
877 views

### Converting numbers to words in Haskell

Here's a program I wrote to convert numbers into English words using Haskell. ...
117 views

### Naive implementation of Burst Balloon

As part of learning Haskell, I'm solving few problems, usually solved imperatively. I've come up with a naive solution for the problem described here, which is to find a sequence in which to burst a ...
135 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 ...
420 views

Just looking for some critiques hopefully from haskellers of how I might be breaking monad laws or just monadding all wrong. My or is something like the ...
2k views

### Speedup for Project Euler 44 - pentagon numbers

I'm trying to solve the problems of Project Euler with Haskell within less than 10s with optimized code (ghc -O2). Unfortunately, I'm struggling to find a correct ...
714 views

### m,n,k-game (i.e. generalized tic-tac-toe)

I'm back after Tic-Tac-Toe in Haskell with a new version. I added Haddock documentation and wrote a generalized version known as the m,n,k-game. By doing so, I had to redefine ...
136 views

### A guarded FizzBuzz

Vogel612 and I decided to take a shot at the StackSTV challenge in Haskell. This is part of the CRitter Collaboration challenge. Except I don't know any Haskell. So let's try a FizzBuzz first! I'm ...
2k views

### Graham Scan convex hull algorithm

I'm beginning to learn Haskell. I've implemented the Graham Scan algorithm for detection of convex hull following the Real World Haskell book. I'm looking for general advice regarding the style and ...
1k views

### Advent of Code 2018 day 1 part 2: find the first repeated number after some increases and decreases

Here is the problem: Part Two You notice that the device repeats the same frequency change list over and over. To calibrate the device, you need to find the first frequency it reaches twice. ...
355 views

### 2D Convex hull exercise

I'm reading Real World Haskell, and this is my first try with the language. This is the result of the exercises of chapter 3: Consider three two-dimensional points a, b, and c. If we look at ...
99 views

### Yet another BrainF*** Interpretter in Haskell

I wrote a BrainF*** interpretter in Haskell. A general review would be helpful and especially, a suggestion with a better way to deal with the IO (IO Memory, IO ()) ...
2k views

### Reverse Polish Notation Calculator

Working through Learn You a Haskell, I made a Reverse Polish Notation calculator. Please critique it. ...
583 views

### Poor AI for 2048 written in Haskell

I'm learning Haskell and thought it would be fun to write an AI for the game 2048 in Haskell. In my implementation I got rid of the randomized aspects of the game. This makes the program ...
70 views

### Recommend Next Note Purchase

I have just started trying to learn Haskell and tried to think of a practical, but simple problem to try and solve. I have a strong background in C, but am just beginning to dip my toes in the world ...
94 views

### 'Tis the season for gift-wrapping

When reviewing a Graham scan convex hull algorithm implementation, I wrote the following function in an answer: ...
262 views

### Caesar and Vigenère ciphers in Haskell the simple way

There are two ciphers, Caesar and Vigenère, both with an encoder and a decoder. Both work with spaces and can be passed any case (the output will be always lowercased, though). I'm a complete Haskell ...
464 views

### Revised: AI for 2048 in Haskell

This is a revised version of an AI for the game 2048, written in Haskell. Link to original thread: Poor AI for 2048 written in Haskell I think this version is a lot cleaner, thanks to the tips from ...
68 views

### 3-function program computing connected components of a point cloud given a distance matrix

I wrote this code in Haskell (instead of Python) for the educational benefit. Can anyone suggest ways to improve this code? I'm guessing that I'm using fromIntegral...
198 views

### How to avoid big tuple return types?

I recently got serious about learning Haskell and upon finishing chapter 4 in Real World Haskell, I decided to try out my accumulated knowledge on a project of my own. This code hosted on github is a ...
218 views

### Implementation of Graham Scan algorithm in Haskell

Here is an implementation of Graham Scan algorithm for computing the convex hull of a finite set of points: ...
1k views

### Implement fold on a “Rose Tree”

Given the following algebraic data type, a Rose Tree: data Tree a = Node { rootLabel :: a, subForest :: [Tree a] } I attempted a ...
291 views

### Sum Arithmetic Progression in Haskell

I am learning Haskell and as exercise I am doing Project Euler Problems. In this case PE1. ...
79 views

### Polishing partitions - Reimplementing a partitionOn

So I've read an F# question on partitioning a list in F# and wondered whether I could cleanly write the concept down in haskell and if that would help me review the code ... Now I have a haskell ...
204 views

### Vigenere Cipher - Haskell Implementation

I'm reading 'Haskell Programming from First Principles' book written by Christopher Allen and Julie Moronuki. As part of the exercises, I'm supposed to implement encryption and decryption functions ...
2k 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 ...
185 views

### Caesar and Vigenère ciphers in Haskell, Take 2 (not so simple this time)

I've posted my simple ciphers on Code Review several days ago (link: here). I refactored my code and tried to define a more general "cipher" function, according to Zeta's excellent advice. I've split ...