Haskell is a functional programming language featuring strong static typing, lazy evaluation, extensive parallelism and concurrency support, and unique abstraction capabilities.

49
votes
1answer
3k views

What is the monomorphism restriction?

I'm puzzled by how the haskell compiler sometimes infers types that are lesspolymorphic than what I'd expect, for example when using point-free definitions.It seems like the issue is the "...
587
votes
11answers
113k views

What is the difference between . (dot) and $ (dollar sign)?

What is the difference between the dot (.) and the dollar sign ($)?. As I understand it, they are both syntactic sugar for not needing to use parentheses.
15
votes
1answer
1k views

Why shouldn't I mix tabs and spaces?

I often read that I shouldn't mix tabs and spaces in Haskell, or that I shouldn't use tabs at all. Why?
1172
votes
41answers
196k views

What is a monad?

Having briefly looked at Haskell recently, what would be a brief, succinct, practical explanation as to what a monad essentially is?I have found most explanations I've come across to be fairly ...
232
votes
6answers
21k views

Haskell: What is Weak Head Normal Form?

What does Weak Head Normal Form (WHNF) mean? What does Head Normal form (HNF) and Normal Form (NF) mean?Real World Haskell states:The familiar seq function evaluates an expression to what we ...
23
votes
3answers
24k views

Deploying Yesod to Heroku, can't build statically

I'm very new to Yesod and I'm having trouble building Yesod staticallyso I can deploy to Heroku.I have changed the default .cabal file to reflect static compilationif flag(production)cpp-...
760
votes
15answers
215k views

Getting started with Haskell

For a few days I've tried to wrap my head around the functional programming paradigm in Haskell. I've done this by reading tutorials and watching screencasts, but nothing really seems to stick.Now, ...
66
votes
4answers
14k views

Does Haskell have tail-recursive optimization?

I discovered the "time" command in unix today and thought I'd use it to check the difference in runtimes between tail-recursive and normal recursive functions in Haskell.I wrote the following ...
15
votes
2answers
3k views

Operating on a return from a Maybe that contains “Just”

I have a function that has a return type of Maybe ([(Int,Int)],(Int,Int))I would like to call this from another function and perform an operation on the data.However, the return value is contained ...
113
votes
2answers
6k views

Memory footprint of Haskell data types

How can I find the actual amount of memory required to store a value of some data type in Haskell (mostly with GHC)? Is it possible to evaluate it at runtime (e.g. in GHCi) or is it possible to ...
36
votes
9answers
2k views

How do I define Lisp’s apply in Haskell?

Shouldn’t this definition be allowed in a lazy language like Haskell in which functions are curried?apply f []=fapply f (x:xs)=apply (f x) xsIt’s basically a function that applies the given ...
177
votes
4answers
11k views

Good examples of Not a Functor/Functor/Applicative/Monad?

While explaining to someone what a type class X is I struggle to find good examples of data structures which are exactly X.So, I request examples for:A type constructor which is not a Functor.A ...
90
votes
5answers
10k views

Applicatives compose, monads don't

Applicatives compose, monads don't.What does the above statement mean? And when is one preferable to other?
99
votes
4answers
9k views

When is memoization automatic in GHC Haskell?

I can't figure out why m1 is apparently memoized while m2 is not in the following:m1=((filter odd [1..]) !!)m2 n=((filter odd [1..]) !! n)m1 10000000 takes about 1.5 seconds on the ...
17
votes
5answers
3k views

Explain this chunk of haskell code that outputs a stream of primes

I have trouble understanding this chunk of code:letsieve (p:xs)=p : sieve (filter (\ x -> x `mod` p /=0) xs)in sieve [2 .. ]Can someone break it down for me? I understand there is ...

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,