299 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
4
votes
1
answer
122
views
How does the point-free expression ((*) .) . (*) work in Haskell?
I'm learning about Haskell and came across this concise, but weird, definition for a function that multiplies three numbers:
volume :: Float -> Float -> Float -> Float
volume = ((*) .) . (*)
...
0
votes
1
answer
192
views
Understand and reduce test execution time with ConcurrencyExtras package in Swift
In my app for unit testing our team heavy rely on tool to execute asynchronous test - ConcurrencyExtras - withMainSerialExecutor
That tool add possibility to launch test code on Main Thread, and also ...
2
votes
1
answer
130
views
Can Bird-Meertens be used to calculate a linear-time solution to this longest valid parentheses problem in Haskell?
The problem: compute the length of the longest matched/valid substring of parentheses given a string composed only of ( and ) characters.
Here's a naive solution:
isValid :: String -> Bool
isValid =...
2
votes
2
answers
122
views
When can a pointful function be refactored to be point free? [duplicate]
What are the conditions on a function of arbitrary number of arguments such that it is able to be refactored to be point free? Is it trivial look at a pointful representation of a function and ...
2
votes
0
answers
178
views
iOS | Composable Architecture | Present modal from root while pushed controllers might also present at that moment
Currently I am working on an hobby/investigation/learning project with the Composable Architecture.
So currently I have an issue that I cannot find a nice solution for unless I start to use UIKit ...
1
vote
1
answer
98
views
What is the resulting type of a simple pointfree implentation of dot product in Haskell? [duplicate]
In Haskell, if you convert a standard dot product of two lists such as
dotProduct :: (Num a) => [a] -> [a] -> a
dotProduct x y = sum $ zipWith (*) x y
through a pointfree tool like pointfree....
0
votes
0
answers
49
views
Haskell point free for more than one argument [duplicate]
I'm trying to achieve a point free version of the following example:
data Person = Person String Int deriving ( Show, Eq )
data Animal = Animal Person deriving ( Show, Eq )
f :: String -> Int ->...
-2
votes
1
answer
111
views
In Haskell how to make a function expression "point-free"
I have a Haskell function like this:
in2out :: String -> String
in2out s =
show (sumAllLineValues $ lines s)
(where sumAllLineValues is defined in my code.)
How can I define in2out point-free, ...
0
votes
1
answer
146
views
Point-free function to add 2 elements to the list / double application of (:) list data constructor and (.)
I am struggling to define correctly the point-free version of the function, which adds 2 elements to the list.
It is easy to come up with a number of straightforward trivial implmentations:
...
2
votes
1
answer
255
views
Can Prolog-like unification be expressed in a point free way?
Pattern matching can be implemented using a point free style, and there are many articles on the internet about it. I'm wondering if the more generalized case also holds, i.e. is it possible to ...
1
vote
1
answer
89
views
Debug Haskell composition chain without converting to point-full representation
I have learned that point-free style is preferred in the Haskell community, and I often write expressions like this:
naive = (slugifyUnicode . T.take maxFilenameSize . T.pack . stripHtmlTags . T....
4
votes
2
answers
160
views
Point-free version of g(f(x)(y))
Is there a way to express the following in point-free form:
g(f(x)(y))
It is not a common 'combinator' as far as I can see, though there are perhaps different ways to express it?
I am working in ...
0
votes
1
answer
152
views
Easy-to-read way of function composition in Javascript [closed]
I'm a huge fan of functional programming. I strive to use point free notation when I can. However, I often don't understand when point free notation is appropriate or when it is overkill. I typical ...
1
vote
1
answer
246
views
Elegant way to access the value of a record in haskell which is inside a monad
Generalisation of question (read below for specifics to my current problem)
Given a function type definition: f :: MonadIO m -> a -> m B where B is a custom datatype B = B {x y z ...} how can I ...
1
vote
3
answers
207
views
Ramda — extract two properties and append one to the other pointfree style
I have some data in the form:
const data = {
list: [1, 2, 3],
newItem: 5
}
I want to make a function that appends the value of newItem to list resulting in this new version of data:
{
list: [...