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

Couldn't match type Haskell [on hold]

I get this error when i run this haskell code! It need to return a list of lists, but i get problems when im concatening 2 lists in 1 list like [1,2] with [3,4] = [[1,2],[3,4]] ...
6
votes
0answers
20 views

Primitive stack-based code interpreter

I've written an interpreter for a simple assembly-like language and it's performing slower than I would like. It's split into 3 files: the Parser that converts the source to a vector of ints, the VM ...
5
votes
0answers
21 views

Website using Persistent, Blaze-html, and Scotty

I know that my let configFilePath = Prelude.head args is unsafe and was wondering how I could handle it better. My deployment almost always has a file at ...
9
votes
2answers
53 views

Haskell FizzBuzz with a type system

The core problem is simple enough, but I've developed a type system that I'm not sure about. The intention is, if the result is a number, calling ...
4
votes
1answer
50 views

Finding Shortest Path

Working on Functionally Solving Problems from Learn You a Haskell, I worked on the "Heahtrow to London" shortest path problem. I'm working on a reduced set of this problem in order to solve a simple ...
3
votes
1answer
54 views

Haskell idioms in functions/arguments handling

I came up with this function rangedReplace as an exercice to use recursion and try different ways to make it work (I made at least 3 completely different versions). ...
5
votes
1answer
36 views

Reverse Polish Notation Calculator

Working through Learn You a Haskell, I made a Reverse Polish Notation calculator. Please critique it. ...
2
votes
1answer
24 views

Folding with trees

I was trying to implement a foldTree function to generate a balanced binary tree from a list of values using foldr (Question 2 ...
4
votes
0answers
56 views

Thinking in 'Haskell' - when to use (state) Monads

I really enjoy Haskell but feel I still have a total beginner's style, and would like to move beyond that. The code below - for Dijkstra's shortest path algorithm - is a case in point. I feel as ...
5
votes
1answer
40 views

Brute force Caesar Cipher decrypter

I wrote the following that tries to crack a message that was encrypted via a simple Caesar cipher through brute force. I'm fairly new to Haskell, so any and all input is appreciated. Because there are ...
3
votes
1answer
28 views

Simplification of consecutive `map`s

I've written the following code: ...
5
votes
2answers
140 views

Merging time series

Is there a better way to do this? A time series, data Model a where Variant :: [(Day, a)] -> Model a deriving (Show) ... where type ...
4
votes
0answers
41 views

Project Euler Problem 18 (Haskell) - Maximum path sum I

I've implemented the solution to Project Euler Problem 18 in Haskell and I'd like to get some thoughts on my implementation. Its the dynamic programming solution, working from the bottom up. ...
3
votes
1answer
19 views

Implementing `randoms`

Learn You a Haskell presents the randoms function. I implemented it as follows: ...
8
votes
1answer
63 views

Random Coin Toss in Haskell

Learn You a Haskell gives an exercise to implement the following function: ...
3
votes
1answer
42 views

Haskell encryption tips

I wrote a variation of the Caeser Cipher and would like some feedback. Is it idiomatic? Can you generally see anything that can be improved? Use example: ...
3
votes
3answers
33 views

Push List Element to Top

Please evaluate this function. It takes a list [a] and an Int, i.e. the index, and returns a new list with the selected item at ...
2
votes
1answer
26 views

Implementing Todo in Haskell

Per Learn You a Haskell, I implemented a simple command-line program, Todo, that accepts 1 of 3 arguments: view or ...
2
votes
2answers
253 views

Counting occurrences of Char8s in a file

To learn some Data.Map and Control.Monad.State, I have written the following code, which should count the occurrences of ...
6
votes
2answers
70 views

Splitting a list into overlapping sub-lists

I'm very new to Haskell. I did try it for a few days, a few years ago... but other than that, this is my second day. I'm equally unused to functional programming, by the way. After much trial and ...
4
votes
1answer
75 views

Dynamic programming with Project Euler #18

I just wanted to get an opinion on my dynamic-programming Haskell implementation of the solution to Project Euler problem 18. The Problem: By starting at the top of the triangle below and moving ...
4
votes
1answer
78 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 ...
2
votes
1answer
33 views

v2 - Adding a duplicate entry randomly into a list in haskell using random monad

Next version of Adding a duplicate entry randomly into a list in haskell using random monad I wrote this trying to set up a Haskell testcase. The aim is to take a list and add a single duplicate from ...
3
votes
2answers
69 views

Haskell Collatz Conjecture

In an attempt to begin properly programming in Haskell, I wrote two functions for calculating numbers and sequences with Collatz's conjecture. I also commented the program quite a lot, because it ...
4
votes
2answers
74 views

Deciding whether a list of sum types is homogeneous

I ran into a problem recently where I had to decide whether a set of sum types was homogeneous (all the same). In itself, this is a pretty simple problem. However, there were a few complicating ...
4
votes
1answer
18 views

Adding a duplicate entry randomly into a list in haskell using random monad

There's a new version of this as v2 - Adding a duplicate entry randomly into a list in haskell using random monad I wrote this trying to set up a Haskell testcase. The aim is to take a list and add ...
1
vote
1answer
37 views

Batch file renamer

Please tell me how I can improve the structure of this simple tool (depends on MissingH): ...
0
votes
3answers
62 views

Function Composition: $ versus `.`

Learn You a Haskell offers the findKey function: Here's the book's implementation: ...
1
vote
1answer
31 views

Substitution Cipher in Haskell

Learn You a Haskell presents the Caesar Cipher: The Caesar cipher is a primitive method of encoding messages by shifting each character in them by a fixed number of positions in the alphabet ...
10
votes
2answers
132 views

Processing text files for data extraction and analysis

I started learning Haskell to see if I can use it at my job. A lot of my work is processing text files for data extraction and analysis. For my first test, I added a counter at the end of each line ...
2
votes
1answer
29 views

Implementing `zip4` in Haskell

Learn You a Haskell explains zip4: --ghci> zip4 [2,3,3] [2,2,2] [5,5,3] [2,2,2] -- [(2,2,5,2),(3,2,5,2),(3,2,3,2)] ...
1
vote
3answers
78 views

Efficient Collatz sequence analysis

I'm new to Haskell, and I'm wondering why my programs are so slow compared to other languages. Haskell, 6 seconds (x64, -O2): ...
5
votes
1answer
31 views

Module representing rational numbers

Taking inspiration from SICP Exercise 2.1, I decided to implement a module in Haskell for rational numbers. Some of my concerns include: Is this idiomatic Haskell? Besides ...
3
votes
2answers
44 views

Implementing Haskell's `insert`

Learn You a Haskell shows the insert function. insert takes an element and a list of elements that can be sorted and inserts it into the last position where ...
0
votes
1answer
43 views

Implementing Haskell's `union`

Learn You a Haskell shows the union function: union also acts like a function on sets. It returns the union of two lists. It pretty much goes over every ...
1
vote
1answer
21 views

Implementing Haskell's \\ (Set Difference)

Learn You a Haskell presents the \\ function. \\ is the list difference function. It acts like a set difference, basically. For every element in the ...
2
votes
1answer
23 views

Implementing Haskell's `delete`

Learn You a Haskell shows the delete function. delete: deletes first occurrence of item ...
5
votes
3answers
454 views

Implementing Haskell's `unwords`

Learn You a Haskell explains the unwords function. $unwords ["hey","there","mate"] "hey there mate" Here's my implementation. ...
2
votes
1answer
33 views

Implementing Haskell#words

Learn You a Haskell shows the words function. words and unwords are for splitting a line of text into words or joining a list of words into a text Example: ...
1
vote
1answer
24 views

Implementing Haskell#break

Learn You a Haskell demonstrates the break function: breaks it when the predicate is first true. Example: ...
1
vote
1answer
34 views

Implementing Haskell#lines

Learn You a Haskell shows the lines function: It takes a string and returns every line of that string in a separate list. Example: ...
1
vote
2answers
39 views

Haskell's `partition`

Learn You a Haskell mentions the partition function: partition takes a list and a predicate and returns a pair of lists. The first list in the result contains ...
1
vote
1answer
30 views

isPrefixOf & isSuffixOf

Please review and suggest improvements for my isPrefixOf implementation. ...
2
votes
1answer
49 views

Removing duplicates from list and filtering non-letter characters

I'm just starting out in Haskell and have been set an assignment for uni where I have to create a reverse index of words in a text file and find what line numbers they appear on. I also have to remove ...
3
votes
1answer
31 views

Haskell's `group` Function

I implemented the group function: ...
2
votes
2answers
46 views

MergeSort w/ Custom Functions

Please review my implementation of mergesort: ...
4
votes
1answer
33 views

Counting items in categories

I'm an experienced programmer that also has a little experience with functional programming, although mostly theoretical (as in hobby-level reading and very minor projects). I recently decided to ...
2
votes
1answer
44 views

Haskell#splitAt

Here's how I wrote the Haskell splitAt function: ...
2
votes
3answers
328 views

Implementing `and` and `or`

I implemented and and or: ...
1
vote
1answer
54 views

Haskell#concat Implementation

Here's how I implemented concat - flattens a list of lists into just a list of elements. ...