A functional programming language
13
votes
2answers
305 views
Side effect-free interface on top of a stateful library
In an interview with John Hughes where he talks about Erlang and Haskell, he has the following to say about using stateful libraries in Erlang:
If I want to use a stateful library, I usually build ...
0
votes
1answer
73 views
Haskell: Best tools to validate textual input?
In Haskell, there are a few different options to "parsing text". I know of Alex & Happy, Parsec and Attoparsec. Probably some others.
I'd like to put together a library where the user can input ...
15
votes
2answers
376 views
Type checking and recursive types (Writing the Y combinator in Haskell/Ocaml)
When explaining the Y combinator in the context of Haskell, it's usually noted that the straight-forward implementation won't type-check in Haskell because of its recursive type.
For example, from ...
8
votes
1answer
280 views
Why isn't there a typeclass for functions?
In a learning problem I've been messing around with, I realised I needed a typeclass for functions with operations for applying, composing etc. Reasons...
It can be convenient to treat a ...
4
votes
3answers
707 views
Why C# is not statically typed but F# and Haskell are?
There was a talk given by Brian Hurt about advantages and disadvantages of static typing. Brian said that by static typing he don't mean C#, but F# and Haskell.
Is it because of dynamic keyword added ...
7
votes
2answers
541 views
Can *any* program task be expressed without state?
This is a theoretical question, but after many years of programming in what I now realize is "normal" imperative technique, using C++ mainly, I've discovered this other world of functional ...
10
votes
2answers
385 views
Functional programming and stateful algorithms
I'm learning functional programming with Haskell. In the meantime I'm studying Automata theory and as the two seem to fit well together I'm writing a small library to play with automata.
Here's the ...
5
votes
1answer
331 views
Maths needed to understand theory behind Haskell's type system?
Recently, I've become deeply interested in Haskell.
While attempting to learn new concepts (e.g. the forall keyword and ST monad) and Haskell's type system in general, I continually run into ...
5
votes
1answer
217 views
Why isn't `length` generic by default?
Haskell often provides two versions of a given function f, i.e:
f :: Int ...
genericF :: Integral i => i ...
There exist many standard library functions with those two versions: length, take, ...
8
votes
3answers
1k views
What are the advantages of using LISP and Haskell? Will they make me a better programmer? [closed]
I know Lisp and Haskell are functional and logic programming languages respectively, but what exactly does this mean? How do they differ from other languages? I've heard that learning these will make ...
0
votes
2answers
456 views
Why don't we have a non-turing complete general purpose language yet? [duplicate]
Non-turing complete languages can solve every practical problem that a turing-complete language can. Also, they are much more analyzable than turing complete languages. The compiler can comprehend the ...
7
votes
1answer
385 views
Why is the Scala Option type not called Maybe, just as in Haskell?
Why is the Scala Option type not called Maybe, just as in Haskell?
Maybe makes a lot more "semantic sense" to me, but maybe Option has different behaviour I am not aware of.
Is there any particular ...
10
votes
2answers
600 views
Haskell memory efficiency - which is the better approach?
We are implementing a matrix compression library based on a modified two dimensional grammar syntax. Now we have two approaches for our data types -which one will be better in case of memory usage? ...
1
vote
1answer
196 views
Why does this article state that graduate education liberate one from concerns like the efficiency of hardware-based integers?
Quoting The Evolution of Haskell Programmer,
graduate education tends to liberate one from petty concerns about,
e.g., the efficiency of hardware-based integers
What exactly does this ...
6
votes
0answers
247 views
in memory datastore in haskell
I want to implement an in memory datastore for a web service in Haskell. I want to run transactions in the stm monad.
When I google hash table steam Haskell I only get this: Data. BTree. HashTable. ...
8
votes
2answers
339 views
Choosing the language to build an app in based on hiring market vs performance and maintainability [closed]
I'm facing a choice of whether to start building Haskell components for a certain production app that is all done in Ruby.
I'm leaning toward Haskell for several reasons, primarily speed (compiled ...
8
votes
3answers
419 views
When is it a good time to reason about performance in Haskell?
Simon Peyton Jones himself recognizes that reasoning about performance in Haskell is hard due to the non strict semantics.
I have yet to write a significant project in haskell so I wonder: can I ...
5
votes
2answers
199 views
Is Haskell function composition an instance of pipe & filter architectural pattern
The pipe & filter architectural pattern is defined as a chain of processing elements, arranged so that the output of each element is the input of the next. Every example seems to consider ...
2
votes
5answers
335 views
The rationale behind Falsy values [closed]
I'm wondering what the arguments for/against Falsy values are. On what principles would you decide to add or exclude them from a language? Are there any problems you could see them causing off-hand?
...
9
votes
3answers
319 views
What is the name of λx.λf.fx (like reverse apply) in lambda calculus? Does the corresponding function have a standard name in programming?
What is the name of λx.λf.fx in lambda calculus?
Does the corresponding function have a standard name in functional programming languages, like Haskell?
In object oriented programming, is there a ...
-1
votes
1answer
284 views
Modern REPL for Haskell - is anybody working on it? [closed]
It's time Haskell had a modern REPL like Mathematica's (or better).
Make each calculation run in a separate thread, so user has control over each computation box's resources (ability to pause, play, ...
7
votes
2answers
651 views
Could we build a functional computer?
As mush as FP has done, in the end, all our programs are structured.
That is, it doesn't matter how pure or functional we make a them - they are always translated to assembly,
so what actually runs ...
-1
votes
1answer
86 views
Exclude the zero in the given data in Haskell [closed]
I have a list of integers.
Also, I have a function which returns True when the element is non-zero, and returns False when the element is zero (let's call it FUNCTION1).
So, how to define another ...
8
votes
1answer
286 views
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 ...
13
votes
2answers
810 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 _ ...
6
votes
2answers
848 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 ...
10
votes
4answers
1k 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?
7
votes
2answers
159 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 ...
4
votes
1answer
247 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
193 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
161 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 ...
10
votes
2answers
538 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. ...
7
votes
2answers
228 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 ...
7
votes
2answers
384 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 ...
13
votes
2answers
797 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
233 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 | ...
18
votes
2answers
812 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 ...
12
votes
0answers
625 views
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 ...
7
votes
3answers
251 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 ...
7
votes
1answer
258 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
2answers
910 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 ...
10
votes
2answers
548 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
304 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
607 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 ...
27
votes
2answers
1k 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 ...
7
votes
3answers
2k 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 ...
13
votes
1answer
453 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
302 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 ...
2
votes
2answers
1k 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
458 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 ...