A functional programming language
12
votes
2answers
493 views
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 _ ...
5
votes
2answers
266 views
Is Haskell/Clojure actually unsuited for dynamic systems such as particle simulation?
I've been told in previous questions that functional programming languages are unsuited for dynamic systems such as a physics engine, mainly because it's costly to mutate objects. How realistic is ...
9
votes
4answers
948 views
In what programming language did “let” first appear?
I was wondering about the origins of the "let" used in Lisp, Clojure, and Haskell. Does anyone know which language it appeared in first?
6
votes
2answers
113 views
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 ...
3
votes
1answer
197 views
Types in Lisp and Scheme
I see now that Racket has types. At first glance it seems to be almost identical to Haskell typing. But is Lisp's CLOS covering some of the space Haskell types cover? Creating a very strict Haskell ...
2
votes
1answer
116 views
Erlang/Haskell web service to server files [closed]
I have across a thread mentioning that Erlang would not be suited for a web application serving files.
I was curious whether anyone had any experience building such webservice with erlang? Would ...
2
votes
1answer
114 views
Good serialization solution for communication between Python AND Haskell programs? [closed]
I found this:
http://msgpack.org/
But.. I've never used it, so I don't know what whether it is much good. Anybody has proposals?
Basic requirements:
serialize as many data structures used ...
5
votes
1answer
325 views
Functional reactive programming — is Fay expressive enough?
So I'm doing a fairly involved javascript/html client with lots of ajax calls and other involvements of callback-ism. I'm entertaining the thought of using Fay for this purpose. I'm aware of Elm. ...
4
votes
2answers
178 views
Who first coined the term Higher Order Function and/or First Class Citizen?
I've come to understand that long before Haskell, O'Caml or LISP, higher order functions were an academic research subject and in mathematics, Schönfinkel (in 1967) and Haskell Curry (in 1968) already ...
5
votes
2answers
316 views
What's a good math textbook to have on my desk while studying Haskell? [closed]
I just started learning Haskell and it seems like you can't get too far in the language without being comfortable ( or at least exposed ) to certain branches of mathematics. Unfortunately I have major ...
8
votes
2answers
263 views
What's the difference in content between Chris Okasaki's 1996 thesis and 1999 book, Purely Functional Data Structures?
I want to read Purely Functional Data Structures. I've easily found the thesis (which is freely available as a PDF), but see that there's a book available also. So I'd like to know what the ...
7
votes
1answer
160 views
Better to use error monad with validation in your monadic functions, or implement your own monad with validation directly in your bind?
I'm wondering what's better design wise for usability/maintainability, and what's better as far as fitting with the community.
Given the data model:
type Name = String
data Amount = Out | Some | ...
17
votes
2answers
708 views
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 ...
8
votes
0answers
434 views
Why (or why not) are existential types considered bad practice in functional programming? [closed]
I've sometimes heard that using existential data types is sort of a bad practice in functional programming and that there are ways how to avoid it. I'd like to know, if it is really true, what are the ...
7
votes
3answers
182 views
Devising test of Haskell's value/reference semantics
In imperative languages, it is trivial to devise a programming test of language's use of "value semantics" or "reference semantics". One could do the following and check the value of a (where Vertex ...
4
votes
1answer
189 views
What monad is the opposite of the error monad in haskell
In the error monad, the first failure halts any execution further just carrying the fault through any following binds.
What monad halts on success only carrying forward successes, and basically ...
24
votes
3answers
541 views
Applying Denotational Semantics to design of Programs
I've read a bit on denotational semantics (DS) and I'm very intrigued about the process of designing computer programs where types and functions have strong and clear mappings to mathematics.
Are ...
5
votes
1answer
171 views
does haskell have dependent types?
The questions all the title. Just to clarify, Haskell already has the ability to parametise a type over another type (this is just like template programming in c++), but can it parametise a type over ...
2
votes
1answer
150 views
Why would I use Control.Exception in Haskell?
I'm trying to really master Haskell error handling, and I've gotten to the point where I don't understand why I would use Control.Exception instead of Control.Monad.Error.
The way I can see it, I can ...
2
votes
1answer
389 views
Fastest Haskell library sort implementation
I am implementing an application in Haskell and, for sorting, I use the library function Data.List.sort. However, I was wondering whether this is the fastest sort implementation in the Haskell ...
26
votes
2answers
959 views
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 ...
6
votes
3answers
1k views
Fastest Functional Language
I've recently been delving into functional programming especially Haskell and F#, the prior more so. After some googling around I could not find a benchmark comparison of the more prominent functional ...
12
votes
1answer
377 views
Why doesn't Haskell have type-level lambda abstractions?
Are there some theoretical reasons for that (like that the type checking or type inference would become undecidable), or practical reasons (too difficult to implement properly)?
Currently, we can ...
3
votes
2answers
263 views
What's the benefit of the Nothing constructor in Haskell?
I'm new to Haskell and I'm not really sold on the Nothing constructor. It sounds like just another silent fail that's going to create headaches down the line. It seems much more useful to throw an ...
1
vote
0answers
186 views
Boost Phoenix or Haskell GHC generating C [closed]
I am working on an iOS app that does some number crunching in a variety of areas that would greatly benefit from a functional programming approach, though much of the rest of the application is ...
2
votes
2answers
491 views
Using foldr to append two lists together (Haskell)
I have been given the following question as part of a college assignment. Due to the module being very short, we are using only a subset of Haskell, without any of the syntactic sugar or idiomatic ...
8
votes
5answers
379 views
What's the proper term for a function inverse to a constructor - to unwrap a value from a data type?
Edit: I'm rephrasing the question a bit. Apparently I caused some confusion because I didn't realize that the term destructor is used in OOP for something quite different - it's a function invoked ...
4
votes
1answer
89 views
Naming conventions for newtype deconstructors (destructors?)
Looking into Haskell's standard library we can see:
newtype StateT s m a = StateT { runStateT :: s -> m (a, s) }
newtype WrappedMonad m a = WrapMonad { unwrapMonad :: m a }
newtype Sum a = Sum { ...
29
votes
4answers
2k views
What can Haskell's type system do that Java's can't and vice versa?
I was talking to a friend about the differences between the type systems of Haskell and Java. He asked me what Haskell's could do that Java's couldn't, and I realized that I didn't know.
After ...
12
votes
1answer
372 views
How often is seq used in Haskell production code?
I have some experience writing small tools in Haskell and I find it very intuitive to use, especially for writing filters (using interact) that process their standard input and pipe it to standard ...
9
votes
8answers
1k views
Why isn't functional language syntax more close to human language?
I'm interested in functional programming and decided to get head to head with Haskell. My head hurts... but I'll eventually get it...
I have one curiosity though, why is the syntax so cryptic (in lack ...
11
votes
2answers
260 views
FP for simulation and modelling
I'm about to start a simulation/modelling project. I already know that OOP is used for this kind of projects. However, studying Haskell made me consider using the FP paradigm for modelling a system of ...
8
votes
9answers
1k views
OS choice for functional developing
I'm mainly a .NET developer so I normaly use Windows/VisualStudio (that means: I'm spoiled) but I'm enjoying Haskell and other (mostly functional) languagues in my spare time.
Now for Haskell the ...
2
votes
1answer
138 views
How do I organize a GUI application for passing around events and for setting up reads from a shared resource
My tools involved here are GTK and Haskell. My questions are probably pretty trivial for anyone who has done significant GUI work, but I've been off in the equivalent of CGI applications for my whole ...
14
votes
1answer
598 views
What's the progress on Haskell records?
Recently I stumbled once again on the issues of Haskells records, in particular the uniqueness of field names (it's a pain ...)
I already read A proposal for records in Haskell from SPJ and Greg ...
15
votes
8answers
2k views
Why is the concept of lazy evaluation useful?
It seems lazy evaluation of expressions can cause a programmer to lose control over the order in which their code is executed. I am having trouble understanding why this would be acceptable or desired ...
30
votes
5answers
2k views
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 ...
16
votes
2answers
490 views
Different ways to see a monad
While learning Haskell I have faced a lot of tutorials trying to explain what are monads and why monads are important in Haskell. Each of them used analogies so it would be easier to catch the ...
0
votes
1answer
498 views
How to force evaluation in Haskell? [closed]
I am relatively new to Haskell and I am trying to learn how different actions can be executed in sequence using the do notation.
In particular, I am writing a program to benchmark an algorithm (a ...
16
votes
5answers
981 views
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 ...
1
vote
2answers
603 views
Performance of concurrent software on multicore processors [closed]
Recently I have often read that, since the trend is to build processors with multiple cores, it will be increasingly important to have programming languages
that support concurrent and parallel ...
23
votes
2answers
1k views
Why did the Haskell committee choose monads to represent IO?
The Clean language uses uniqueness types to handle IO in a purely functional setting. Why did the Haskell committee go with monads instead? Were there other proposals for handling state that the ...
-2
votes
2answers
395 views
Where are functional languages used? [duplicate]
Possible Duplicate:
Functional Programming in Commercial Software
Which problems domains are more suited to functional programming solutions
I just wonder where do functional programming ...
5
votes
4answers
173 views
How do I link an domain object in memory to its database records without cluttering the domain with database concerns?
Your domain model contains a set of objects. I'm here presenting a side project, but I have a much more complicated work project falling to its knees because I didn't do a good separation of the ...
6
votes
2answers
206 views
Language that can statically ensure a map's fields are present
If data is simple and objects are complex, I'm curious if there are any existing statically typed languages that would be able to augment(?) a map type into a type with guaranteed fields. I realize ...
3
votes
2answers
392 views
Lazy Processing of Streams
I have the following problem scenario:
I have a text file and I have to read it and split it into lines.
Some lines might need to be dropped (according to criteria that are not fixed).
The lines ...
5
votes
1answer
441 views
What is this algorithm for converting strings into numbers called?
I've been doing some work in Parsec recently, and for my toy language I wanted multi-based fractional numbers to be expressible. After digging around in Parsec's source a bit, I found their ...
0
votes
2answers
384 views
why are transaction monitors on decline? or are they?
http://www.itjobswatch.co.uk/jobs/uk/cics.do
http://www.itjobswatch.co.uk/jobs/uk/tuxedo.do
Look at the demand for programmers (% of job ads that the keyword appears), first graph under the table. ...
5
votes
3answers
869 views
How is CoffeeScript influenced by Haskell?
I've been using CoffeeScript for a while now. On Wikipedia, it is said that CoffeeScript is influenced by Haskell. But after I check out the syntax of Haskell, I have found little resemblance from ...
7
votes
3answers
300 views
choosing a functional language platform for a new project
I have been writing code for a few years now and I don't believe I can claim to have a complete knowledge in this job yet.
My experience primarily rolls around C# related areas with a decent ...