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

0
votes
1answer
18 views

General TicTacToe in Haskell

I decided to take a more general approach while implementing the TicTacToe game in Haskell. Util ...
4
votes
0answers
23 views

Parsing and plotting complex numbers

I am trying to write a Haskell application that parses a bunch of complex numbers from a Mathematica output and then produces a PPM image. The end product looks like this: The code to create this ...
4
votes
1answer
37 views

TicTacToe game in Haskell

As a beginner, I tried to implement TicTacToe in Haskell. How can I improve my code? I have refactored my code: General TicTacToe in Haskell Utils ...
4
votes
1answer
36 views

Returning all possible player moves on a board

Recently I started to learn Haskell. I did this by making exercises on the Internet. The problem of making these exercises is that I never know if I solved it the correct way. I currently wrote a ...
2
votes
1answer
25 views

Computing all Tic-Tac-Toe moves

Recently I started to learn Haskell. I did this by making exercises on the Internet. The problem of making these exercises is that I never know if I solved it the correct way. I currently wrote a ...
3
votes
1answer
30 views

Merge adjacent numeric intervals

Given a list of pairs of integers that represent closed numeric intervals, I need to output a list of intervals where the adjacent intervals are merged together. The code assumes that the intervals do ...
4
votes
0answers
23 views

Simple Echo Server

I wrote this echo server in Haskell as a way to introduced myself to programming with sockets in Haskell and generally practice Haskell. The echo server has a simple purpose: accept connections from a ...
2
votes
1answer
63 views

Parsing a component of a regex followed by an optional quantifier character

I have a piece of parsec code that parses a unit optionally followed by ?, + or ...
2
votes
1answer
21 views

Reading numbers from a file with lazy ByteString

This is my code for lazily reading a very large file which contains numbers separated by a new line character. Is there a way to simplify this using the ByteString ...
5
votes
2answers
53 views

String sequence in Haskell

Given a string sequence and a string, the function should output the next string of that sequence. For example, for sequence "abc": ...
5
votes
1answer
63 views

Permutations of a list in Haskell

I have this piece of code which given a list returns another list which combines every element with every other element (without repetitions) using a given function as a combiner. I came up with three ...
1
vote
1answer
39 views

Find disjoint integer intervals

Given a list of numeric intervals in the form of (a,b), where a and b are integers, it finds ...
5
votes
1answer
25 views

Implementation of Set data type in Haskell

I'm an advanced beginner Haskell programmer. I implemented a set data type in Haskell and I wanted to find out if I made correct choices when writing it. Would there be a way to improve some of the ...
5
votes
3answers
67 views

Project Euler problem 92 (sequences formed by the sum of squares of digits) in Haskell

I made the following program in Haskell to solve Project Euler's problem 92. The program works (i.e. the solution it yields is correct), but it's not exactly the fastest in the world. The problem is: ...
4
votes
2answers
53 views

Handling request errors in snap with haskell

I'm currently taking a look at Snap with Haskell. I'm pretty new to Haskell and functional programming in general and am working out the best way to handle errors. Currently I have something like this ...
5
votes
0answers
34 views

Finding most frequent words from Google N-Gram dataset

I have written a program to process Google 1-Gram dataset in order to obtain the list of most frequent words. This is my second more or less working program in Haskell, so I really want to know if it ...
7
votes
1answer
107 views

Implement Fibonacci with `iterate`

I implemented the Fibonacci sequence using iterate. ...
6
votes
1answer
42 views

Generating prime candidates

I'd like to generate an infinite list of prime candidates of the form 6k±1, but I'm looking for the fastest possible solution. Currently I have this: ...
3
votes
1answer
39 views

Parsing characters with parsec

I am trying to parse escape sequences as well as plain characters. Can this be made more succinct? ...
5
votes
1answer
40 views

Type Validation using State Monad

I am attempting to build a compiler for a stack-based (or concatenative) programming language in Haskell. I've done fine getting the lexer and parser up and running, but now that I'm into the meat of ...
4
votes
3answers
69 views

Append the contents of latest Stackage nightly build to the global cabal config file

I've made the following python script to to append the contents of the latest Stackage nightly build to the global cabal config file (instead of going to the site, copying the page and appending it ...
5
votes
2answers
62 views

Applicative permutation to generate knight moves

I want to understand Haskell better by trying to stretch possibilities of Functor, Applicative, and Monad as much as possible and study how they behave. So in Learn You a Haskell there's an exercise ...
1
vote
0answers
135 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 ...
1
vote
1answer
53 views

Sum of Multiples

A different approach than this question, this time without using arithmetic progression. The README specs both sumOfMultiples and ...
-1
votes
1answer
47 views

Function to Map `[a] -> [[a]]` [closed]

Given [1,2,3], I wrote the following to get [[1],[2],[3]]: ...
5
votes
1answer
84 views

Finding word acronyms for telephone numbers

Having read most of Learn You a Haskell as well as parts of Real World Haskell, I decided to embark on an easy project to see if I can apply the Haskell that I've learned. ...
3
votes
2answers
67 views

Sum Arithmetic Progression in Haskell

I am learning Haskell and as exercise I am doing Project Euler Problems. In this case PE1. ...
5
votes
1answer
32 views

Safe stack operations with lens

I wrote this code to learn how to work with State monad. Then I added Either result to gracefully handle error condition (stack underflow). I believe most of this code is actually unnecessary. I know ...
10
votes
1answer
141 views

Counting unordered factorizations with distinct parts

Trying to solve this combinatorics problem, I wrote some functions to count the number of unordered distinct factorizations of an integer n into ...
1
vote
2answers
91 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 ...
4
votes
3answers
144 views

Phone List challenge

To learn Haskell, I've been going at this challenge, which is to check a list of phone numbers to ensure that no number is a prefix of another. However, my code is way too slow. I am really new to ...
6
votes
0answers
66 views

Just another Graham scan implementation in Haskell

It looks like this is a really classical question, but I'd like to ask it one more time as all those solutions look quite long and complicated for me (maybe because I am dumb :) ) So this is a Graham ...
2
votes
1answer
82 views

Generating alphanumeric combinations

I was happy with my shell script that needed to generate alphanumeric combinations of length N (in this case, 3) for i in {a..z}{a..z}{a..z}; do ... Now I became ...
10
votes
1answer
107 views

Detecting cycles in a directed graph without using mutable sets of nodes

I recently came across the classic algorithm for detecting cycles in a directed graph using recursive DFS. This implementation makes use of a stack to track nodes currently being visited and an extra ...
7
votes
2answers
206 views

Project Euler #1 in Haskell

Looking for feedback/critiques/alternatives to my solution for the 1st Project Euler question: ...
4
votes
1answer
98 views

Fake Marquee Text in Haskell

This is my very first complete, non-completely-trivial Haskell program, and I'm extremely unfamiliar with the language. I was hoping that I could get some pointers on how to make it more idiomatic. ...
12
votes
1answer
98 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 ...
7
votes
1answer
80 views

Snake in Haskell

I wrote a partial implementation of Snake in Haskell. As of now, it only supports the movement of the snake. However, since the code is getting complex, I'm requesting for a review of the code before ...
7
votes
1answer
66 views

Fermat Factorization

Please review my implementation of Fermat's Factorization. ...
1
vote
1answer
33 views

Append Tuple to Two `Maybe []`

The following function appends a tuple to two Maybe [a]'s. ...
2
votes
1answer
25 views

Mixing Lens operations with “original” operations

Is it reasonable to mix Control.Lens operations with the ones provided by the "standard library"? Consider the following fragment using qualified ...
3
votes
2answers
48 views

Return list with numbers of color occurrences in another list

I'm solving "mastermind game" problem from CIS haskell course. Here is the link to assignment pdf if someone is interested. List of possible colors is defined like this: ...
4
votes
1answer
63 views

Tic Tac Toe game in haskell follow up

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? ...
8
votes
2answers
93 views

Tic Tac Toe game in Haskell

...
5
votes
2answers
79 views

Rock Paper Scissors game

This is a very simple rock paper scissors game implemented in Haskell. ...
7
votes
1answer
71 views

Conways game of life in Haskell

I started with Haskell some months ago, but didn't really use it since then. As a simple training I implemented Conways game of life. What/How could it be improved? ...
3
votes
1answer
46 views

Haskell Sudoku solver using bactracking

This solves Sudoku by using backtracking. Accepts one grid where 0 represents a missing number. Here are some examples: http://norvig.com/easy50.txt The program is quite slow. Input is stdin. ...
4
votes
2answers
67 views

Prime factorization in Haskell

I am a Haskell beginner. Here is my function to find prime factors of a number ...
4
votes
1answer
44 views

Textual representation of a C++ function

I need to create an instance of Show of a somewhat complicated type that represents a C++ function. The "serialization" gives me a Haskell interpretation of the ...
2
votes
1answer
26 views

Haskell marking procedure for non-unique lists

I'm writing a function for generating solutions for a backtracking search problem. To that end, I need to mark an item from a list by removing it from that list, and placing it in a second list. So I ...