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
219
votes
6 answers

What exactly makes the Haskell type system so revered (vs say, Java)?

I'm starting to learn Haskell. I'm very new to it, and I am just reading through a couple of the online books to get my head around its basic constructs. One of the 'memes' that people familiar with it have often talked about, is the whole "if it…
phatmanace
  • 2,445
  • 3
  • 14
  • 11
102
votes
2 answers

What is the "Free Monad + Interpreter" pattern?

I've seen people talking about Free Monad with Interpreter, particularly in the context of data-access. What is this pattern? When might I want to use it? How does it work, and how would I implement it? I understand (from posts such as this) that…
Benjamin Hodgson
  • 4,488
  • 2
  • 25
  • 34
71
votes
8 answers

How do you encode Algebraic Data Types in a C#- or Java-like language?

There are some problems which are easily solved by Algebraic Data Types, for example a List type can be very succinctly expressed as: data ConsList a = Empty | ConsCell a (ConsList a) consmap f Empty = Empty consmap f (ConsCell a b) =…
Jörg W Mittag
  • 101,921
  • 24
  • 218
  • 318
66
votes
4 answers

Is Haskell's type system formally equivalent to Java's?

I realize some things are easier/harder in one language than the other, but I'm only interested in type-related features that are possible in one and impossible/irrelevant in the other. To make it more specific, let's ignore Haskell type extensions…
user39685
65
votes
4 answers

what is the purpose of arrows?

I am learning functionnal programming with Haskell, and I try to grab concepts by first understanding why do I need them. I would like to know the goal of arrows in functional programming languages. What problem do they solve? I checked…
Simon Bergot
  • 7,930
  • 3
  • 35
  • 54
52
votes
1 answer

How do you design programs in Haskell or other functional programming languages?

I have some experience in object oriented programming languages like c# or ruby. I know how to design a program in object oriented style, how to create classes and objects, and how to define relations between them. I also know some design…
Luke
  • 551
  • 1
  • 5
  • 7
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,555
  • 1
  • 47
  • 81
48
votes
7 answers

Haskell AND Lisp vs. Haskell OR Lisp

I currently code with C, C++, and Python. I'm wanting to pick up a functional programming language, and right now I'm leaning toward Haskell. I do NOT want to start a "Haskell vs Lisp" war here; what I want to know is this: if I learn Haskell…
Zeke
  • 1,854
  • 2
  • 15
  • 22
47
votes
5 answers

Critique of the IO monad being viewed as a state monad operating on the world

The IO monad in Haskell is often explained as a state monad where the state is the world. So a value of type IO a monad is viewed as something like worldState -> (a, worldState). Some time ago I read an article (or a blog/mailing list post) that…
Petr
  • 5,507
  • 3
  • 29
  • 46
43
votes
2 answers

Why (or why not) are existential types considered bad practice in functional programming?

What are some techniques I might use to consistently refactor code removing the reliance on existential types? Typically these are used to disqualify undesired constructions of your type as well as to allow consumption with a minimal of knowledge…
Petr
  • 5,507
  • 3
  • 29
  • 46
42
votes
3 answers

What are the advantages of using LISP and Haskell? Will they make me a better programmer?

I know Lisp and Haskell are logic and functional programming languages respectively, but what exactly does this mean? How do they differ from other languages? I've heard that learning these will make you a better programmer and improve your logic.…
Logan545
  • 635
  • 1
  • 6
  • 5
42
votes
2 answers

Misconceptions about purely functional languages?

I often encounter the following statements / arguments: Pure functional programming languages do not allow side effects (and are therefore of little use in practice because any useful program does have side effects, e.g. when it interacts with the…
Giorgio
  • 19,486
  • 16
  • 84
  • 135
41
votes
2 answers

Do modern languages still use parser generators?

I was researching about the gcc compiler suite on wikipedia here, when this came up: GCC started out using LALR parsers generated with Bison, but gradually switched to hand-written recursive-descent parsers; for C++ in 2004, and for C and…
eatonphil
  • 561
  • 4
  • 8
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
38
votes
12 answers

Scheme vs Haskell for an Introduction to Functional Programming?

I am comfortable with programming in C and C#, and will explore C++ in the future. I may be interested in exploring functional programming as a different programming paradigm. I am doing this for fun, my job does not involve computer programming,…
haziz
  • 499
  • 1
  • 6
  • 9
1
2 3
17 18