All Questions
Tagged with functional-programming haskell
91
questions
1
vote
1
answer
75
views
Meta Collatz Sequence
Context
Chapter 6 of Learn You A Haskell contains a function called chain, which outputs the Collatz sequence of a given input.
(In short, it takes a natural number....
1
vote
1
answer
56
views
2
votes
1
answer
124
views
Project Euler 11 Haskell - Largest product in a grid
Intro
I have been learning haskell and functional programming using random Project Euler problems. Currently, I have solved Problem 11.
What is the greatest product of four adjacent numbers in the ...
4
votes
1
answer
832
views
Haskell: implementing Read for a custom dynamic value type
I'm using Haskell to interpret a dynamically-typed language. I have a sum type called Value which can represent some basic objects:
...
5
votes
1
answer
318
views
Validate Finnish IBANs
I am currently studying an online course in Haskell and there are no "model examples" of the assignments after finishing them. I'm slowly getting the hang of this, but I'd like some feedback ...
3
votes
1
answer
248
views
Efficiently calculating perfect powers in Haskell
I'm trying to calculate perfect powers to solve this code wars challenge: https://www.codewars.com/kata/55f4e56315a375c1ed000159/haskell
The number 81 has a special property, a certain power of the ...
3
votes
0
answers
188
views
Advent of Code 2021, Day 3 in Haskell
This is a working solution to today's Advent of Code puzzle, written in Haskell. However, I feel like this solution is not optimal.
...
4
votes
1
answer
750
views
Is there a better way to apply a filter over an Either right value?
Suppose you have an IO (Either String (String, [Int])) and you want to filter the [Int].
Let's say we want to use the following ...
5
votes
1
answer
2k
views
Reading a CSV file using Haskell
I'm reading a CSV using Haskell. I'm not sure if this is the appropriate way to do it.
This is what I'm doing:
Read rows from a CSV -> return lazy byte string
Parse the headers and rows from the ...
1
vote
3
answers
87
views
Word frequency finder
Challenge: find the top three most frequently used words in a string. Only imports from the base package are allowed (source: codewars)
I'm looking for feedback on (...
5
votes
1
answer
173
views
Small combinator parsing library in Haskell
I recently wrote code to parse lambda expressions written in a lisp like format, using a small hand-rolled parsing library.
The goal
This code was written as a part of this code-golf challenge not as ...
3
votes
2
answers
1k
views
Haskell Function to get the List representation of an Integral
This is a simple practice problem. The task is to write a function getLR that receives an Integral, ...
1
vote
0
answers
71
views
Count number of days within each date range in a list of date ranges
Happily picked up Haskell a couple days back and working on the following use case.
Given a list of JSON objects with date fields and a start date, I want to create a list of weeks (here a tuple of ...
3
votes
2
answers
54
views
7
votes
1
answer
401
views
A beginner's brainfuck interpreter in Haskell
I am rather new to haskell, and could use some feedback on my code and the decisions I had to make. In my previous project, I made a JSON parser, but relied heavily on guidance from a university ...