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

2
votes
1answer
60 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 ...
9
votes
1answer
50 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
92 views

Project Euler #1 in Haskell

Looking for feedback/critiques/alternatives to my solution for the 1st Project Euler question: ...
3
votes
1answer
75 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
67 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 ...
6
votes
1answer
63 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
56 views

Fermat Factorization

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

Append Tuple to Two `Maybe []`

The following function appends a tuple to two Maybe [a]'s. ...
2
votes
1answer
24 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 ...
2
votes
2answers
30 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
53 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? ...
7
votes
2answers
78 views

Tic Tac Toe game in Haskell

...
5
votes
2answers
68 views

Rock Paper Scissors game

This is a very simple rock paper scissors game implemented in Haskell. ...
7
votes
1answer
53 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
33 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
49 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
25 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 ...
4
votes
1answer
34 views

Find the common elements of the lists in a list of lists

Considering the problem: Make a function to find the common elements of the lists in a list of lists. Example: common ( [ [1,2,3,3,5,11], [2,2,2,3,3,5], [2,2,3,3,4,5,6,7,18,19], ...
5
votes
1answer
34 views

L system equations

This is my first program on my second try to learn haskell :) ...
1
vote
1answer
18 views

Rebuilding WAR files in webapps directory

This script cleans up destination directory and copies file into it with new name. Can this intent be expressed more cleanly with shelly? ...
5
votes
1answer
27 views

Levenshtein Distance with Haskell Vectors and Memoization

Is the following an effective way to implement the Levenshtein Distance with Haskell vectors? ...
2
votes
1answer
49 views

DRY Kleisli wrappers with lens

This currently does what I intend: ...
3
votes
1answer
52 views

Hackerrank, Service Lane in Haskell

Problem statement Calvin is driving his favorite vehicle on the 101 freeway. He notices that the check engine light of his vehicle is on, and he wants to service it immediately to avoid any ...
2
votes
1answer
37 views

Palidrome checker in haskell

I decided to avoid the trivial isPalindrome lst = lst == reverse lst and tried writing a method with pattern matching and recursion. ...
8
votes
4answers
685 views

Brute-force perfect-number algorithm

I whipped a reasonably fast brute-force perfect number finding function in Haskell, after seeing a similar thing in mathematica. It works in under 3 seconds when I search up to 1000, but 10000 is too ...
4
votes
3answers
94 views

Hackerrank, Utopian Tree in Haskell

Problem statement The Utopian tree goes through 2 cycles of growth every year. The first growth cycle occurs during the monsoon, when it doubles in height. The second growth cycle occurs ...
5
votes
1answer
81 views

Haskell 99, Problems 1-10 (simple list processing)

I'm just learning Haskell and I wanted to know if I'm going in the right direction with my solving of the Haskell 99 problems. The file of interest is here which I've also reproduced below. ...
5
votes
1answer
111 views

SICP Exercise 1.3: Sum of squares of two largest numbers out of three, Haskell Version

The exercise 1.3 of the book Structure and Interpretation of Computer Programs asks the following: Exercise 1.3. Define a procedure that takes three numbers as arguments and returns the sum of ...
2
votes
1answer
62 views

Huffman code generator in Haskell

This is problem 50 in https://wiki.haskell.org/99_questions/46_to_50. The website has more elegant Haskell solutions, but I wanted to get feedback on how the code I wrote on my own below could be ...
4
votes
2answers
35 views

Network arithmetic, finding the next host for the given

Disclaimer: It's literally the second time I write in Haskell. The purpose of this module is to provide some basic operations with IP addresses (and networks). At the moment I only implemented the ...
5
votes
1answer
103 views

Haskell: Efficient and clear list concatenation

I'm trying to write a function explodeBy: ...
3
votes
1answer
42 views

Print a sequence of n numbers

I have a simple function that takes an Integer n and return a string representing the array from 1..n. ...
1
vote
1answer
41 views

Replacing items in a list

I was wondering why replace is not in base. I thought, it's because it must be easy to implement with standard combinators. ...
4
votes
0answers
59 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 ...
4
votes
2answers
72 views

Fast way to count the numbers that are divisible by their own sum of digits inside a range

Inspired by this question on Stack Overflow, I wrote a function that returns the length of a list made of numbers that are divisible by their own sum of digits inside a range: ...
2
votes
1answer
50 views

Polymorphic components for graphics and program state

I asked this question on StackOverflow, got some answers, most notably a link to this one, and basing on that I've implemented this: ...
3
votes
2answers
38 views

Implement 'filtering'

The NICTA Haskell Course presents the following function to implement on List: ...
5
votes
2answers
45 views

Checking in four directions for board game win

I have the following code which I would like to simplify in Haskell, although I'm not sure how. I recall that I can use monads to simplify a case chain when the result of the case leads onto a next ...
2
votes
1answer
19 views

UPenn homework 3: histogram

Please see here for the general description. Exercise 3: histogram :: [Integer] -> String takes as input a list of ...
3
votes
3answers
42 views

UPenn Homework 3: localMaxima :: [Integer] -> [Integer]

Please see this question for the general description. Exercise 2: localMaxima :: [Integer] -> [Integer] A local maximum of a list is an element of the list ...
5
votes
2answers
83 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, ...
2
votes
1answer
67 views
2
votes
1answer
159 views

Maybe getting a character from a list of strings

I'm trying to transition from JavaScript to PureScript (a Haskell spinoff that transpiles to JavaScript). For starters I coded this: ...
5
votes
2answers
77 views

Knuth's Word Wrap Algorithm in Haskell

I put together a Haskell function for Knuth's word wrap algorithm. A simplified version of the algorithm is described here. I've already been told that there are certain aspects of my style that are ...
2
votes
0answers
41 views

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

I've implemented generic insertAt function which inserts value to a list independently from is list indexed or not. Here are some examples: ...
5
votes
2answers
55 views

Another Brainfuck interpreter in Haskell

I came up with the following Brainfuck interpreter in Haskell after thinking about how to represent the program and the memory functionally using zippers to represent current location. This works ...
4
votes
2answers
91 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: ...
3
votes
1answer
39 views

Attempt at Abstracted YAML Configuration Loader

I've been playing around with writing a simple static blog generator in Haskell (mostly for experience, since there's probably more than a few already made choices that fit my needs). I don't have ...
3
votes
0answers
31 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 ...