Questions tagged [haskell]

A functional programming language

Haskell is a pure functional programming languages defaulting to lazy evaluation. It has strong links with Mathematics, especially Formal Logic, Lambda Calculus, Combinatorics, and Group Theory.

http://www.haskell.org/

#haskell on irc.freenode.net

260 questions
49
votes
5 answers

Are there any downsides or problems with Haskell?

I'm looking at diving into Haskell for my next (relatively trivial) personal project. The reasons that I'm tackling Haskell are: Get my head into a purely functional language Speed. While I'm sure this can be argued, profiling that I've seen nails…
Demian Brecht
  • 17,585
38
votes
5 answers

"A proof is a program; the formula it proves is a type for the program"

This might be a philosophical kind of question, but I believe that there is an objective answer to it. If you read the wikipedia article about Haskell, you can find the following: The language is rooted in the observations of Haskell Curry and his…
user21125
26
votes
2 answers

Why does Haskell have built-in "if/then/else" instead of defining it as a simple library function?

Why does Haskell have a built-in if/then/else, which is dependent on the Bool type, instead of having a simple library function? Such as if :: Bool -> a -> a -> a if True x _ = x if False _ y = y
Petr
  • 5,517
  • 3
  • 29
  • 46
21
votes
3 answers

does haskell have dependent types?

I know Haskell already has the ability to parametrise a type over another type (similar to template programming in C++), but I'm wondering whether Haskell can also parametrise a type over values – whether it supports dependent types. With dependent…
20
votes
3 answers

How to improve efficiency with functional programming?

I've recently been going through the Learn You a Haskell for Great Good guide and as practice I wanted to solve Project Euler Problem 5 with it, which specifies: What is the smallest positive number that is evenly divisible by all of the numbers…
Overv
  • 1,170
  • 1
  • 9
  • 15
19
votes
4 answers

Is Haskell good at teaching fundamentals of mathematics?

I'm involved in teaching mathematics to classes with requirements such as AS and A level Mathematics specification. Class books normally provide examples of computer software applied to mathematics tasks, but they are normally based on software…
16
votes
3 answers

How important are Haskell's advanced concepts like Monads and Applicative Functors for most routine programming tasks?

I've read the Learn You a Haskell book up to the point where they introduce Monads and stuff like Just a. These are so counterintuitive for me that I just feel like giving up trying to learn it. But I really want to try. I'm wondering if I can at…
dan
  • 2,273
  • 3
  • 22
  • 23
14
votes
1 answer

Why are data constructors with the same name disallowed in different type constructors?

The following declaration gives an error: type Vec2d = (Float, Float) type Vec3d = (Float, Float, Float) -- Rect x y defines a rectangle spanning from (0,0) to (x,y) data Obj2d = Rect Float Float | Translate Vec2d Obj2d -- Cuboid x y z…
A Sz
  • 242
13
votes
1 answer

Is it possible to prove a function is idempotent?

Is it possible to use static or dependent types to prove a function is idempotent? I've searched Google and various places on StackOverflow/StackExchange for the answer with no luck. The closest I've found was this conversation about…
bmaddy
  • 241
  • 1
  • 5
12
votes
1 answer

Why do Haskell functors only have derived types in their target category?

In Haskell, the Functor typeclass functor is defined as follows (see e.g. Haskell wiki): class Functor (f :: * -> *) where fmap :: (a -> b) -> f a -> f b As far as I understand (please correct me if I am wrong), such a functor can only have as…
Giorgio
  • 19,646
11
votes
1 answer

Necessity to learn haskell language extension for production

Haskell core language is really simple. Coming from an OO background, the main difficulty is to adapt to the pure functional paradigm. While learning "basic" Haskell, I have always considered language extensions as toys for CS people or as…
Simon Bergot
  • 7,970
  • 4
  • 35
  • 55
9
votes
2 answers

Inspirational software for end-users written in Haskell?

I think great technology is invisible. Besides the usual suspects (GHC, Xmonad, proprietary trading software) what great examples are there of end-user software written in Haskell? I think good examples are FreeArc, Hledger and "Nikki And The…
8
votes
1 answer

How does one reason about algorithmic complexity in Haskell?

In Haskell, lazy evaluation can often be used to perform efficient calculations of expressions that are written in a clear and concise manner. However, it seems that the language itself does not provide enough details to determine, in general, the…
7
votes
3 answers

Dealing with (the risks of) infinite sequences in Haskell

I'm a couple of weeks into dabbling with haskell and I've made a pretty big dent in Learn You A Haskell. I feel like many of the type classes and common implementations up to applicatives and monads make a lot of sense to me and I understand how…
sara
  • 2,559
7
votes
2 answers

Why have a wrapper constructor when storing a function in a data type?

I can never do too many Haskell tutorials. There is always something to refine and learn. So, I am working through chapter 10 of Real World Haskell, and everything makes sense. but Why do newtype Parse a = Parse { runParse :: ParseState -> Either…
1
2 3