Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 40580

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.

2 votes
Accepted

A function determining intervals of values greater than threshold

In Haskell, when you have a list, an index is not the idiomatic way to represent its items. What do you want with those indices? Agreed, your version is hard to read. …
Franky's user avatar
  • 665
5 votes

Parametrize by type constructor?

Do the same with Operator and you've got: data BinTree op a = Leaf a | BinaryNode op (BinTree op a) (BinTree op a) Based on your haskell experience, you might want to write your Functor, Applicative, … Haskell philosophy Haskell is a functional language. While "functional" puts the emphasis on functions, it is actually data-centric. …
Franky's user avatar
  • 665
1 vote

Project Euler # 1: Sum of multiples of 3 or 5 less than 1000 in Haskell

Please don't take any of this personal. -- all multiples of 3 less than 1000 multOfThree = [3*x | x <- [1..333] ] You need a comment for this, because the spec(fication) say 1000 and you use 333. W …
Franky's user avatar
  • 665
2 votes
Accepted

Minesweeper in haskell

Generally in haskell it is recommended to either have only one data constructor with the same name as the type or different constructor names, e.g. data Tile = Closed Bool PlayerMarking | Opened Int In … is not regarded as idiomatic haskell, and here, you can do mostly without. (Mostly? It is inevitable for the player input.) …
Franky's user avatar
  • 665
3 votes

Finding Shortest Path

Data representation My critique starts here: data Tree a = EmptyTree | Node a (Tree a) (Tree a) Why is a node forced to have 2 sub-trees? Given a graph like this: B1 - C1 | | A - B2 - …
Franky's user avatar
  • 665
1 vote

Brute-force perfect-number algorithm

The Answer based on mersenne primes is unbeatable in speed, but if you want to extend your code for abundant numbers sumDivisors n > n or deficient numbers ... < n, there are some options left. Low-L …
Franky's user avatar
  • 665
3 votes

A Haskell implementation of Conway's Game of Life, viewable on the console, no external libs

Naming, the first Normally haskell is written in camelCase, not under_scores. … i into a variable (or binding, as haskell programmer might prefer) named state. This is a list (of lists). …
Franky's user avatar
  • 665
3 votes

Transitive graph

There is some asymmetry in your code: addPairPreservingGraphTransitivity gr c@(a,b) | F.any ((== b) . fst) gr = S.insert c . S.union gr . S.map (\x -> (a,x)) . S.map snd . S.filter ((== b) . fst) $ …
Franky's user avatar
  • 665
5 votes
Accepted

TicTacToe in Haskell

A haskell beginner using Control.Lens... Certainly better than my first program which happened to a tic tac toe solver, so I can compare. We all know Why functional programming matters, don't we? …
Franky's user avatar
  • 665
2 votes

Another Brainfuck interpreter in Haskell

I am building on bisserlis' answer here. interpret uses a lot of repetition that can be reduced with case..of. That allows a where clause which factors out common code that modifies memory and simply …
Franky's user avatar
  • 665
2 votes
Accepted

Huffman code generator in Haskell

Specify imports Do you know the names of all functions in Data.List? Me neither. Specify what you import like import Data.List (delete) In my final version, this becomes import Data.List (minimum …
Franky's user avatar
  • 665
2 votes

Levenshtein Distance with Haskell Vectors and Memoization

The google results for haskell levenshtein Array are only marginally better than your Vector approach. …
Franky's user avatar
  • 665
1 vote
Accepted

Type Validation using State Monad

I concentrate on Are there segments that could be more idiomatically written? and probably overdo it. fst $ runState can be written as evalState. Look at this: vl <- validateSequence (r …
Franky's user avatar
  • 665
3 votes
Accepted

Mapping and sorting lists of Haskell tuples

At some point in you haskell journey, you will do that. When you grow wiser, you will value readability over succinctness. Long story short: This part is OK. …
Franky's user avatar
  • 665
3 votes

HackerRank, Haskell simple "compression" algorithm

Of course the haskell way of writing it is f x | x > 1 = "bar" | otherwise = "foo" but I like my code to closely mirror the problem statement, see next section. …
Franky's user avatar
  • 665