0 | module FS.Elin
 1 |
 2 | import public Control.Monad.Elin
 3 | import public FS.Pull
 4 |
 5 | import Data.SnocList
 6 |
 7 | %default total
 8 |
 9 | ||| Convenience alias of `run` for running a `Pull` in the `Elin s`
10 | ||| monad, producing a pure result of type `Outcome es r`.
11 | export %inline covering
12 | pullElin : (forall s . EmptyPull (Elin s) es r) -> Outcome es r
13 | pullElin f = either absurd id $ runElin (pull f)
14 |
15 | ||| Convenience alias of `run` for running a `Pull` in the `Elin s`
16 | ||| monad, producing a pure result.
17 | export %inline covering
18 | mpullElin : Monoid r => (forall s . EmptyPull (Elin s) [] r) -> r
19 | mpullElin f = either absurd id $ runElin (mpull f)
20 |
21 | export %inline covering
22 | toSnocList : (forall s . Stream (Elin s) [] o) -> SnocList o
23 | toSnocList p = mpullElin (lastOr [<] $ fold (:<) [<] p)
24 |
25 | export %inline covering
26 | toList : (forall s . Stream (Elin s) [] o) -> List o
27 | toList p = toSnocList p <>> []
28 |