All Questions
Tagged with functional-programming haskell
99 questions
6
votes
1
answer
473
views
Terse finite state machines in Haskell
I'm writing a parser for a markup language in haskell, and a finite state machine fell out of my ideal API. I have code that looks a bit like this:
Token = BoldWord String | Word String | ...
31
votes
3
answers
6k
views
Definition of "functor"; Haskell vs. C++
I'm trying to understand whether the Haskell and C++ communities mean different things by the word "functor", or if there's some underlying concept that unifies the two meanings.
My ...
0
votes
2
answers
215
views
Is a safe function returning Maybe partial or total?
The Elm Guide says to use Maybe for partial functions, but I was under the impression that returning Maybe solves the problem of partial functions and makes them total. It gives a value from the ...
9
votes
4
answers
4k
views
Functional programming - what to learn and who uses it
I'm a .Net and Angular developer who's been working with OO languages throughout my education and work history. Lately I've been thinking about spending some time with one of the functional ...
3
votes
3
answers
236
views
Precisely define "what to solve" and "how to solve" corollary in functional and imperative programming respectively
I am not sure if I ever clearly understood standard corollary "what to solve" and "how to solve" used to point out difference between functional (declarative) and imperative programming paradigm ...
-3
votes
2
answers
137
views
How can we handle inserts/delete cases using Map like data structures in FP?
Let's say, that we keep track of students entering the auditorium using their IDs(Key) and their check-in time(Value) in a Map. We delete the entries once they move out of the auditorium. I want to ...
6
votes
1
answer
724
views
What's the benefit of avoiding partial functions in Haskell?
AFAIK in Haskell it is heavily recommended to avoid partial functions; and if these seem unavoidable (eg head) then return a Maybe. At least, so the Haskell wiki says 1 2
What's the use of the ...
1
vote
4
answers
471
views
In Haskell, is it a "violation" of functional programming to interact with something that was not a function parameter?
I'm sure this must have been asked before, but I can't find anywhere that actually answers my question, so apologies if I have simply overlooked this.
I am currently learning Haskell, and loving the ...
0
votes
1
answer
206
views
In what other locations besides infinite streams and infinite lists is memoized lazyness useful?
Haskell is one of the few non-strict languages out there.
In his paper Why Functional Programming Matters, John Hughes uses (memoized) lazy evaluation (as well as higher-order functions) to implement ...
2
votes
2
answers
2k
views
Patterns for tracking state in recursive Haskell code
A frequent pattern in my Haskell code is element-wise recursion for transformation of a list with some carried state generated using the data in the list. Usually, this looks something like this:
...
2
votes
1
answer
139
views
Dynamic *dll substitution?
I got an architectural problem here.
Let say there is an IShell. It mainly responsible to map user's commands (represented as a linux-like strings) to an appropriate IExecutable's.
Those ...
6
votes
3
answers
383
views
Can referential transparency be assumed when dealing with floating-point arithmetic?
A pure function is assumed to produce the same outputs given the same inputs. Suppose an (otherwise) side-effects free function computes with floating-point numbers. Due to numerical error, these ...
1
vote
0
answers
87
views
How Functional Programming addresses concurrent increment/decrement operations invoked by different users? [duplicate]
Using Functional language, How can 2 different parties achieve the result of increment/decrement operations concurrently?
For the below scenario, Let's say, I've 2 quantities in stock and 2 users in ...
1
vote
2
answers
878
views
How Functional Programming addresses concurrent increment/decrement operations invoked by different users?
Using Functional language, How can 2 different parties achieve the result of increment/decrement operations concurrently?
For the below scenario,
Let's say, I've 2 quantities in stock and 2 users in ...
37
votes
7
answers
9k
views
What are the functional equivalents of imperative break statements and other loop checks?
Let's say, I've the below logic. How to write that in Functional Programming?
public int doSomeCalc(int[] array)
{
int answer = 0;
if(array!=null)
{
for(...