Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [haskell]

This challenge is related to the Haskell language. Note that challenges that require the answers to be in a specific language are generally discouraged.

3
votes
0answers
139 views

Min-Max GHC command line error bytes to bytes of source code

GHC command line errors can be horrible, lets make them as bad as possible. To disincentivize very long programs use the following formula to calculate your "score". ...
9
votes
2answers
437 views

Interpreted arithmetic

A little known fact is that if you turn on enough language extensions (ghc) Haskell becomes a dynamically typed interpreted language! For example the following program implements addition. ...
33
votes
21answers
12k views

Wait, what language is this?

Recently I had the pleasure of writing a Haskell program that could detect if the NegativeLiterals extension was engaged. I came up with the following: ...
15
votes
4answers
560 views

Tuple addition in pointfree

What is the shortest way we can express the function f(a,b)(c,d)=(a+c,b+d) in point-free notation? pointfree.io gives us ...
18
votes
12answers
3k views

Let's make Diet Haskell

Haskell has tuples that can be written as (a,b,c) However this is just syntactic sugar for (,,)a b c In general an n tuple ...
-4
votes
4answers
264 views

Sort a list without builtin functions

Sorting a list would make a pretty fun code-golf challenge, but all the builtins make it boring! Its no fun when you spend all of your time golfing a function and then you see that someone else has a ...
52
votes
72answers
9k views

Sugar Free Syntax

In Haskell the list notation: [a,b,c] Is just syntactic sugar for: a:b:c:[] And the string notation: ...
7
votes
6answers
693 views

Most concise way to fold tree structures

Background (F#) Let there be trees: type Tree<'T> = Node of 'T * Tree<'T> list Now lets fold them nicely with a function called... ...
6
votes
5answers
295 views

Write biSp in point-free form using as few terms as possible

The Haskell function biSp has type signature ...
2
votes
1answer
250 views

Immutable dictionaries in Haskell [closed]

You need to implement immutable dictionaries using only functions without any other data types (custom or built-in). The dictionary must be indexed by any data type of class Eq and contain values of ...
18
votes
3answers
2k views

Shortest a -> b -> (a -> b) function in Haskell

I got the following question at a test: Write a function f with the following type a -> b -> (a -> b). ...
69
votes
47answers
9k views

Tips for golfing in Haskell

What general tips do you have for golfing in Haskell? I am looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Haskell. Please post only one ...
11
votes
2answers
436 views

What is a good way to deal with tasks that require arrays using Haskell?

Often a task requires real arrays. Take for instance the task to implement Befunge or ><>. I tried to use the Array module for this, but it's really cumbersome, ...