facF = intDispF >==< mapF fac >==< intInputF
The functionscounterF = intDispF >==< mapstateF count 0 >==< buttonF "Up"
mapstateFcreate abstract fudgets, that is, fudgets that do not perform any I/O. They communicate only via their high-level streams.
A more general way to construct abstract fudgets is provided by
whereabsF :: SP a b -> F a b
SPis the type constructor for plain stream processors. These have a single input stream and a single output stream. The function
absFcreates a fudget by connecting the streams of a stream processor to the high-level streams of the fudgets, while leaving the low-level streams disconnected, as shown in Figure 21.
Figure 21. Turning a stream processor into an abstract fudget.
mapstateF are in fact
defined in terms of
wheremapF = absF mapSP mapstateF = absF mapstateSP
are discussed in Section 16.2 and Section 16.3, respectively.mapSP :: (a -> b) -> SP a b mapstateSP :: (a -> b -> (a, [c])) -> a -> SP b c
Although high-level combinators like
mapstateF are adequate for most fudget application programming,
some programmers may prefer the flexibility of the more basic ways
of creating stream processors. Two examples where abstract fudgets
are defined in terms of
absF can be found in
Section 32.4. An extensive discussion of stream processors can
be found in Part III.