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
0answers
6 views

Applicative permutation

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
113 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
47 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
38 views

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

Given [1,2,3], I wrote the following to get [[1],[2],[3]]: ...
-2
votes
0answers
14 views
5
votes
1answer
80 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
60 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
0answers
20 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 ...
2
votes
0answers
34 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
79 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
129 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
57 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
77 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
88 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
163 views

Project Euler #1 in Haskell

Looking for feedback/critiques/alternatives to my solution for the 1st Project Euler question: ...
4
votes
1answer
95 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
83 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
78 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
65 views

Fermat Factorization

Please review my implementation of Fermat's Factorization. ...
1
vote
1answer
31 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
43 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
57 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
86 views

Tic Tac Toe game in Haskell

...
5
votes
2answers
70 views

Rock Paper Scissors game

This is a very simple rock paper scissors game implemented in Haskell. ...
7
votes
1answer
69 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
42 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
58 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
35 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
35 views

L system equations

This is my first program on my second try to learn haskell :) ...
1
vote
1answer
19 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
28 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
52 views

DRY Kleisli wrappers with lens

This currently does what I intend: ...
3
votes
1answer
79 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
41 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
693 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
123 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
91 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
115 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
86 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
36 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
118 views

Haskell: Efficient and clear list concatenation

I'm trying to write a function explodeBy: ...
3
votes
1answer
45 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
48 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
75 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
84 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
56 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
44 views

Implement 'filtering'

The NICTA Haskell Course presents the following function to implement on List: ...