Questions tagged [arrows]

Arrows are a means of modeling computational effects that are more general and less powerful than Monads.

Arrows can express relationships between nodes in a graph (a tree is a type of graph).

Arrows can be primitives in computer graphics.

In some programming languages, arrow symbols like -> and => are syntax with specific meaning.

335 questions
12
votes
2 answers

Why can't I define a Haskell Arrow instance in terms of arr and *** / &&&

I'm still getting to grips with defining and using Arrows in Haskell. While defining new arrows, it is much easier for me to think in terms of *** or &&& rather than first and second, as most of the time I want special processing for when two arrows…
Anupam Jain
  • 7,851
  • 2
  • 39
  • 74
12
votes
1 answer

"Generalized arrows" and proc notation?

When learning about Control.Arrow and Haskell's built-in proc notation, I had the idea that this language might prove very useful as an eDSL for general monoidal categories (using *** for tensor and >>> for composition), if only the Arrow typeclass…
Nathan BeDell
  • 2,263
  • 1
  • 14
  • 25
12
votes
5 answers

Adding arrows to scrollbar

I'm trying to add arrows to the x and y axes of the scrollbar, here's my scrollbar: http://jsfiddle.net/Nk3NH/ And I want this arrow(image) for the two axes: https://i.stack.imgur.com/i6Un2.png I'm looking for the code that add the arrows like that…
user2401856
  • 468
  • 4
  • 8
  • 22
11
votes
3 answers

exposition on arrows in haskell

What would be a good place to go to understand arrows? Ideally, I am just looking for some place with a concise definition with motivation from some good examples, something similar to Wadler's exposition on monads.
user8865
  • 113
  • 1
  • 6
11
votes
2 answers

Bifunctor vs. Arrow methods

There is a bit of overlap between Bifunctor and Arrow methods: class Bifunctor p where first :: (a -> a') -> p a b -> p a' b second :: (b -> b') -> p a b -> p a b' bimap :: (a -> a') -> (b -> b') -> p a b -> p a' b' class Arrow (~~>) where …
dfeuer
  • 48,079
  • 5
  • 63
  • 167
11
votes
0 answers

Is there something like a continuation Arrow transformer?

The ContT monad transformer has a interesting property: If there is a * -> * type such as Set, that has well-defined monadic operations, but can't have a Monad instance due to some constraints (here Ord a), it's possible to wrap it in ContT (ContT r…
Petr
  • 62,528
  • 13
  • 153
  • 317
11
votes
2 answers

Are Arrows a true generalization of functions?

Arrows are often described as generalization of functions (statically generated functions only, i.e. there's no support for partial application / closures). However, at least looking at Arrows as they are modeled in Haskell, I can't see how they can…
Dr DR
  • 667
  • 1
  • 5
  • 8
11
votes
1 answer

How does mapA work with a Stream Function Arrow in Haskell?

Background I've been going through John Hughes' Programming with Arrows, and I felt that I had everything straight in my head until the following example of using mapA: >runSF (mapA (delay 0))…
aftertommy
  • 113
  • 5
11
votes
2 answers

What's wrong with this implementation of quicksort using Arrows?

Ok, so I thought of having some fun with arrows. I tried to directly translate the sexy Haskell quicksort to an implementation that uses arrows instead. But it does not work correctly. import Control.Arrow qs :: Ord a => [a] -> [a] qs = isEmpty >>>…
haskelline
  • 1,116
  • 7
  • 15
10
votes
2 answers

No Arrow buttons in Scrollbar after writing webkit Css

Please refer to the table here. http://www.funkkopfhoerer-test.com/vergleichstabelle-funkkopfhoerer/ I'm using Table Plugin and created a custom scrollbar on top of it. But It wasn't showing up on Safari browsers until it is enabled in Safari…
Danish iqbal
  • 123
  • 1
  • 2
  • 10
10
votes
2 answers

How are Arrows and Functions different in haskell?

I learned and searched about Arrows for a while, and I'm a bit confused about necessity of Arrow class. As I know, Arrow class is abstraction of function, and Arrow A a b c represents something takes input of type b and output of type c. Also, it…
Remagpie
  • 685
  • 6
  • 15
9
votes
2 answers

Is (\f -> fmap f id) always equivalent to arr?

Some instances of Category are also instances of Functor. For example: {-# LANGUAGE ExistentialQuantification, TupleSections #-} import Prelude hiding (id, (.)) import Control.Category import Control.Arrow data State a b = forall s. State (s -> a…
Aadit M Shah
  • 72,912
  • 30
  • 168
  • 299
9
votes
4 answers

How to use Kleisli arrows with monads?

In the Haskell Control.Arrow documentation it talks about Kleisli arrows' relationship to monads, but it is not obvious to me how to use this. I have a function which I think fits with arrows except for it involving the IO monad, so I think Kleisli…
Opa
  • 335
  • 2
  • 7
9
votes
2 answers

Observable recursion (or binding) in Arrows

I am trying to find a way to translate normal recursive notation such as the |fib| function below to an arrow, retaining as much of the structure of the recursive notation as possible. In addition I would like to inspect the arrow. For this I…
Alessandro Vermeulen
  • 1,321
  • 1
  • 9
  • 28
8
votes
2 answers

Hughes' Fibonacci stream

I am trying to understand the "Streams as arrows" section in John Hughes' famous "Generalising Arrows to Monads". To be more precise, I am interested in writing down the Fibonacci stream. I tweaked Hughes' definition a bit: data StreamProcessor a b…
Zhiltsoff Igor
  • 1,812
  • 8
  • 24
1 2
3
22 23