Skip to main content

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.

Filter by
Sorted by
Tagged with
1 vote
1 answer
198 views

Shorten this recursive even fibonacci implementation [closed]

I have the following Haskell code to generate the the values of the Fibonacci sequence which are even as an infinite list: ...
Wheat Wizard's user avatar
  • 99.6k
11 votes
2 answers
880 views

Curry tips for Haskell programmers

Curry is the Language of the Month this month and some users are starting to get into it, so let's get some tips together. Haskell and Curry are similar in a lot of ways and a lot of tips for Haskell ...
Wheat Wizard's user avatar
  • 99.6k
18 votes
1 answer
1k views

How to golf a fork in Haskell?

I'm trying to make a pointfree function f that can act like APL's dyadic forks/Husk's §, so ...
user's user avatar
  • 377
17 votes
3 answers
748 views

Tips for restricted source in Haskell

I tested the waters on this sort of question with python, but now I get to the real question I want to ask. restricted-source challenges are uniquely rewarding in Haskell because of Haskell's strict ...
Wheat Wizard's user avatar
  • 99.6k
8 votes
2 answers
326 views

Is there a shorter way to express this haskell idiom?

Every so often I have a function of type a -> b and a function of type b -> b -> c and I would like a function of type <...
Wheat Wizard's user avatar
  • 99.6k
5 votes
2 answers
1k views

Point-free madness

This challenge is about Haskell point-free style polynomial functions. Although you don't need to know Haskell language to do this challenge, Haskellers might have an advantage here. Point-free ...
Damien's user avatar
  • 2,447
3 votes
1 answer
236 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". ...
Kyle McKean's user avatar
10 votes
3 answers
641 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. ...
Wheat Wizard's user avatar
  • 99.6k
46 votes
34 answers
16k 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: ...
Wheat Wizard's user avatar
  • 99.6k
18 votes
4 answers
933 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 ...
Wheat Wizard's user avatar
  • 99.6k
21 votes
12 answers
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 ...
Wheat Wizard's user avatar
  • 99.6k
-6 votes
5 answers
556 views

Sort a list without builtin functions

Your task will be to write a Haskell function that takes a list of integers and returns a sorted version of the same list. You are to do this without the use of builtins What are builtins? To keep ...
Wheat Wizard's user avatar
  • 99.6k
62 votes
85 answers
10k views

Sugar Free Syntax

In Haskell the list notation: [a,b,c] Is just syntactic sugar for: a:b:c:[] And the string notation: ...
Wheat Wizard's user avatar
  • 99.6k
8 votes
6 answers
1k 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... ...
Good Night Nerd Pride's user avatar
9 votes
5 answers
376 views

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

The Haskell function biSp has type signature ...
dspyz's user avatar
  • 933
2 votes
1 answer
326 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 ...
Curly Brace's user avatar
21 votes
3 answers
3k 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). ...
Radu Stoenescu's user avatar
88 votes
58 answers
17k 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 ...
Animesh 'the CODER''s user avatar
11 votes
2 answers
570 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, ...
FUZxxl's user avatar
  • 10.1k