2-- Module : Streamly.Internal.Data.Cont
3-- Copyright : (c) 2020 Composewell Technologies
4-- License : BSD-3-Clause
5-- Maintainer : streamly@composewell.com
6-- Stability : experimental
9-- Continuation style utilities.
11module Streamly.Internal.Data.Cont
16import Control.Monad.Cont (runCont, cont)
18-- | Given a continuation based transformation from @a@ to @b@ and a
19-- continuation based transformation from @[b]@ to @c@, make continuation based
20-- transformation from @[a]@ to @c@.
24-- You can read the definition as:
26-- > contListMap f g = \xs final ->
29 (a -> (b -> r) -> r) -- transform a -> b
30 -> ([b] -> (c -> r) -> r) -- transform [b] -> c
31 -> ([a] -> (c -> r) -> r) -- transform [a] -> c
32contListMap f g xs final =
33 let bconts = fmap (cont . f) xs -- [Cont b]
34 blistCont = sequence bconts -- Cont [b]
35 k ys = g ys final -- [b] -> r
36 in runCont blistCont k -- r
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list