python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
Defining a function that satisfies a type in Haskell
Considering the type
foo :: a -> ((b -> a) -> c) -> c
I want to create a function that satisfies this type...
I know foo x y = y (\z -> x) satisfies this type as confirmed with :type i...
v.t
Votes: 0
Answers: 3
Disappearing applicative?
I'm a bit confused about the behavior of pure in a case where its Applicative instance is unspecified. In this example, I expect the resulting value to be the number 5 in an applicative context:
Prelu...
TonyM
Votes: 0
Answers: 1
Trouble understanding the behavior of `foldr` and `map` in Haskell
I have a function prefixes that, given [1, 2, 3], returns the prefixes [[1], [1, 2], [1, 2, 3]]. It is defined as follows:
prefixes :: Num a => [a] -> [[a]]
prefixes = foldr (\x acc -> [x] : ...
Liam White
Votes: 0
Answers: 3
Prepend (:) function definition in Haskell
I would like to better understand some code I am looking at in a course I am taking. I used Ghci to deduce the type of (:) to be (:) :: a -> [a] -> [a]. I would like to know exactly how that fun...
Liam White
Votes: 0
Answers: 2