# DeepArrow

### From HaskellWiki

(Difference between revisions)

m (initial) |
|||

Line 1: | Line 1: | ||

The '''DeepArrow''' library is a framework for composable "editors" of pure values. |
The '''DeepArrow''' library is a framework for composable "editors" of pure values. |
||

− | * darcs get http://darcs.haskell.org/packages/DeepArrow |
+ | * Download the code: '''<tt>darcs get http://darcs.haskell.org/packages/DeepArrow</tt>''' |

− | * Read the Haddock docs (with source code & Comment/Talk links) |
+ | * [http://darcs.haskell.org/packages/DeepArrow/doc/html Read the Haddock docs] (with source code & Comment/Talk links) |

== Introduction == |
== Introduction == |
||

By an "editor", I mean a function that targets a transformation at some part of a value, such as the first half of the second half of a value of type <hask>(a,(b,c))</hask>. In such a case, the transformation being targeted would have type <hask>b -> b'</hask>, and the overall transformation would have type <hask>(a,(b,c)) -> (a,(b',c))</hask>. |
By an "editor", I mean a function that targets a transformation at some part of a value, such as the first half of the second half of a value of type <hask>(a,(b,c))</hask>. In such a case, the transformation being targeted would have type <hask>b -> b'</hask>, and the overall transformation would have type <hask>(a,(b,c)) -> (a,(b',c))</hask>. |
||

− | If you've fooled around with arrows, you might guess that the arrow methods ''first'' and ''second'' having something to do with this game, and you'd be right. The main idea of DeepArrow is to play with compositions of ''first'' and ''second'' and of an analogous third combinator called ''result''. I was stunned to realize that arbitrarily complex value editors can be made by stringing together compositions of these three combinators and delighted to find that the composition chains directly spell out the paths to the value subpart to be edited. |
+ | If you've fooled around with arrows, you might guess that the arrow methods <hask>first</hask> and <hask>second</hask> having something to do with this game, and you'd be right. The main idea of DeepArrow is to play with compositions of <hask>first</hask> and <hask>second</hask> and of an analogous third combinator called <hask>result</hask>. I was stunned to realize that arbitrarily complex value editors can be made by stringing together compositions of these three combinators and delighted to find that the composition chains directly spell out the paths to the value subpart to be edited. |

+ | |||

+ | The DeepArrow library is about "deep function application" in two senses. First, compositions of <hask>first</hask>, <hask>second</hask>, and <hask>result</hask> apply functions deeply inside of values. Second, another set of combinators, <hask>funFirst</hask>, <hask>funSecond</hask>, and <hask>funResult</hask> extract "deep functions" so they can be applied. |
||

== Background == |
== Background == |
||

− | The inspiration for value-editing paths came while I was looking for a way for non-programmers to be able to create [http://conal.net/Pan functional images]. I've had a growing intuition over the last fifteen years that media authoring tools can be usefully looked at as environments for functional programming. I'd been wondering how to map a user's gestures into operations on a functional program. |
+ | The inspiration for value-editing paths came while I was looking for a way for non-programmers to be able to create [http://conal.net/Pan functional images]. I've had a growing intuition over the last fifteen years that media authoring tools can be usefully looked at as environments for functional programming. I'd been wondering how to map a user's gestures into operations on a functional program. Lots of noodling led to ideas of composable interfaces and "tangible values" (term thanks to Sean Seefried) and gestural composition in [http://conal.net/Eros Eros]. |

− | ... |
+ | Eros was more complicated than I like, so I started splitting it into pieces: |

+ | * [http://conal.net/Phooey Phooey] is a functional GUI library that has much of Eros's GUI implementation techniques, but much more carefully structured than in the Eros paper. |
||

+ | * [http://haskell.org/haskellwiki/DeepArrow DeepArrow] has the general notion of "deep application". |
||

+ | * [http://haskell.org/haskellwiki/TV TV] has the algebra of ''composable interfaces'', or visualizations of pure values, and it has ''tangible values'', which are separable combinations of interface and value. It uses Phooey to generate GUIs very simply from interfaces. |

## Revision as of 07:50, 15 January 2007

The **DeepArrow** library is a framework for composable "editors" of pure values.

- Download the code:
`darcs get http://darcs.haskell.org/packages/DeepArrow` - Read the Haddock docs (with source code & Comment/Talk links)

## 1 Introduction

By an "editor", I mean a function that targets a transformation at some part of a value, such as the first half of the second half of a value of type(a,(b,c))

b -> b'

(a,(b,c)) -> (a,(b',c))

first

second

first

second

result

first

second

result

funFirst

funSecond

funResult

## 2 Background

The inspiration for value-editing paths came while I was looking for a way for non-programmers to be able to create functional images. I've had a growing intuition over the last fifteen years that media authoring tools can be usefully looked at as environments for functional programming. I'd been wondering how to map a user's gestures into operations on a functional program. Lots of noodling led to ideas of composable interfaces and "tangible values" (term thanks to Sean Seefried) and gestural composition in Eros.

Eros was more complicated than I like, so I started splitting it into pieces:

- Phooey is a functional GUI library that has much of Eros's GUI implementation techniques, but much more carefully structured than in the Eros paper.
- DeepArrow has the general notion of "deep application".
- TV has the algebra of
*composable interfaces*, or visualizations of pure values, and it has*tangible values*, which are separable combinations of interface and value. It uses Phooey to generate GUIs very simply from interfaces.