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

1
vote
1answer
46 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
0answers
15 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: ...
0
votes
0answers
41 views

Haskell parser for the programming language Tiny [on hold]

I am learning Haskell and as such am trying to create a parser for the Tiny Programming language. Since the grammar is very short, I'll just include it here. You can also find it at the linked ...
0
votes
0answers
14 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
26 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
47 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
39 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
91 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
91 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 ...
3
votes
1answer
57 views
2
votes
2answers
47 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 ...
2
votes
2answers
45 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 ...
5
votes
1answer
58 views

Data structure for expression evaluation in Haskell

Program behaviour Hi! New haskeller here. I've made a data structure for mathematical expressions. I want to parse mathematical expressions like ...
5
votes
1answer
51 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
61 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
107 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
63 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
240 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
683 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 ...
3
votes
1answer
562 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
74 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
31 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 ...
1
vote
1answer
43 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
92 views

Fizz Buzz in Haskell

Pretty straightforward, I implemented the popular fizz buzz challenge in Haskell. ...
4
votes
2answers
67 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
22 views

Haskell union list implementation pt 2

This is my revision from another post ...
3
votes
1answer
52 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
60 views

List of tuples generated through list comprehension

The function returns a list of tuples which is generated through list comprehension: ...
1
vote
0answers
24 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 ...
3
votes
1answer
57 views

Updates list in haskell to remove duplication

The task in question allows a user to re-rate a film such that only the latest rating from the user should remain in the database. Initially I solved this problem in a very basic manor? This was my ...
4
votes
2answers
93 views

Walking a directory in Haskell

I wrote a function that recursively walks a given directory. ...
4
votes
0answers
43 views

Roman numerals in Haskell

I have written a module that provides some functions for dealing with Roman numerals. I would like some feedback concerning my style, potential performance or elegance improvements, and any ...
3
votes
2answers
48 views

A function determining intervals of values greater than threshold

I wonder if there exists a shorter/more elegant functional programming way than listing all the possible cases. Here, a function that determines positions of beginning/end of subintervals greater than ...
3
votes
3answers
50 views

In a list of pairs, replace snds with median of all snds with the same fst

Given is a list of pairs. I want to replace the second element of all pairs with the median of the second elements of all pairs with the same first element. For example: ...
5
votes
0answers
28 views

Manual instantiations of common typeclasses for a machine word data type

I've written a data type to represent a word in the memory of a MIX computer. A MIX word has a sign bit and five six-bit bytes. So I created a data type and provided instances for all the common ...
2
votes
1answer
66 views

Returning the common divisors of two integers

I have written this function that returns the common divisors of two integers. When called recursively 10 times with big integers ranging in 100000000, it takes over 5 seconds. How can I improve it so ...
4
votes
0answers
53 views

Multiple base numbers parser

This code is a Parser that parses numbers according to R5RS. #b1001 - binary #o2127 - octal #h02d - hexadecimal #d1231 - decimal 3923 - decimal It is ...
5
votes
1answer
104 views

CIS194: Risk!-style “battles”

After reading LYAH and using RWH as a reference, I've been doing the exercises from CIS194, which is often suggested to beginners on irc://freenode.net/#haskell and ...
3
votes
2answers
41 views

Finding heaviest path through triangle

I am doing Project Euler problem 67 which involves finding the heaviest path through a triangle of integers like this one (this is a smaller version from an earlier problem) ...
2
votes
1answer
43 views

Haskell zmq & protobuf message forwarding

I wrote a test program (and first "real" Haskell program!) that receives a zmq request on 1 socket, and forwards part of that message to another socket. There are a 2 things I specifically don't ...
4
votes
1answer
60 views

soundex implementation

The soundex algorithm maps several spellings of a name to a 4 character term. (hopefully mapping all different transcriptions to the same term) The steps as described in Introduction to information ...
6
votes
1answer
64 views

Approximating π via Monte Carlo simulation

Inspired by a tweet linked to me by a friend and a Haskell implementation by her for the same problem, I decided to try my hand at approximating the value of π using everything in the Haskell standard ...
5
votes
1answer
37 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 ...
7
votes
2answers
74 views

Simple command-line password generator

I'm very new to Haskell, I've read most of learnyouahaskell.com and played around with some simple things, but this is probably the most 'complicated' bit of Haskell I've written so far. I have an ...
4
votes
1answer
65 views

Converting image size from Maybe (Int, Int) to (Float, Float)

I have a function that returns size of an image IO (Maybe (Int, Int)) It would be nice to convert it to float tuple beautifully. I am sure there must be a better ...
5
votes
1answer
73 views

Project Euler problem 11, finding adjacent numbers with the greatest sum

The full description of the problem to solve can be found here. The code I have written works fine but seems extremely verbose for what it's doing, I'm not sure if list comprehensions are meant to be ...
6
votes
1answer
58 views

1 or 2 Player CLI Tic-Tac-Toe

I wrote a simple tic-tac-toe program in Haskell. It runs on the command line, has a one and two player mode, and implements a minimax algorithm when you play against it. I'm used to writing proper ...
1
vote
1answer
31 views

Convert a string into an R vector expression

Problem: Given a arbitrary string, split by a given regex and format into an R vector expression. E.g. Convert "a..,b..,c,d" into 'c("a","b","c","d")', when the given regex is "[.,]+". Solution in ...
9
votes
2answers
386 views

Resistance is futile, Resistors have been dispatched to model your Resistance

Since it was getting boring to always do OOP Languages I decided to dabble in the functional realm of programming. For that I chose the narrowly missed community-challenge by Edward: Resistor Mania, ...
4
votes
1answer
74 views

GitHub API client

Here is my Haskell program designed to list all of my GitHub repos along with their descriptions and languages via the GitHub JSON APIs: ...