Personal tools

Unamb

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search
m (Abstract: replaced paper reference to push-pull-frp)
m (Abstract: removed stray newline)
Line 8: Line 8:
 
Operationally, the value of <hask>unamb u v</hask> becomes available when the earlier of <hask>u</hask> and <hask>v</hask> does.
 
Operationally, the value of <hask>unamb u v</hask> becomes available when the earlier of <hask>u</hask> and <hask>v</hask> does.
 
The agreement precondition ensures unamb's referential transparency.
 
The agreement precondition ensures unamb's referential transparency.
For more info about <hask>unamb</hask> and its use, see the paper
+
For more info about <hask>unamb</hask> and its use, see the paper ''[http://conal.net/papers/push-pull-frp/ Push-pull functional reactive programming]'', sections 10 and 11.
''[http://conal.net/papers/push-pull-frp/ Push-pull functional reactive programming]'', sections 10 and 11.
 
   
 
<hask>unamb</hask> was originally a part of [[Reactive]]. I moved it to its own package in order to encourage experimentation.
 
<hask>unamb</hask> was originally a part of [[Reactive]]. I moved it to its own package in order to encourage experimentation.

Revision as of 16:45, 18 February 2011


1 Abstract

unamb is a package containing the unambiguous choice operator
unamb
, which wraps thread racing up in a purely functional, semantically simple wrapper. Given any two arguments
u
and
v
that agree unless bottom, the value of
unamb u v
is the more terminating of
u
and
v
. Operationally, the value of
unamb u v
becomes available when the earlier of
u
and
v
does.

The agreement precondition ensures unamb's referential transparency.

For more info about
unamb
and its use, see the paper Push-pull functional reactive programming, sections 10 and 11.
unamb
was originally a part of Reactive. I moved it to its own package in order to encourage experimentation.

Besides this wiki page, here are more ways to find out about unamb:

See also the lub package, which extends unamb's usefulness with non-flat types.

2 Issues

Although semantically very simple, unamb has been quite tricky to implement correctly and efficiently.

As of version 0.1.1, unamb requires ghc 6.10 or better.

As of version 0.1.6, unamb correctly handles recursive termination of sub-efforts and automatic restarting, but only with the GHC RTS fixes that first appeared (stably, by my testing) in GHC HEAD version 6.11.20090115. The problems and solution can be found in a few places:

unamb seems to be working well in version 0.2.2, under GHC 6.10.3.