1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
-- |
-- Definitions of lazy Deque.
--
-- The typical `toList` and `fromList` conversions are provided by means of
-- the `Foldable` and `IsList` instances.
module Deque.Lazy
( LazyDefs.Deque,
fromStrict,
toStrict,
LazyDefs.fromConsAndSnocLists,
LazyDefs.cons,
LazyDefs.snoc,
LazyDefs.reverse,
LazyDefs.shiftLeft,
LazyDefs.shiftRight,
LazyDefs.filter,
LazyDefs.take,
LazyDefs.drop,
LazyDefs.takeWhile,
LazyDefs.dropWhile,
LazyDefs.span,
LazyDefs.uncons,
LazyDefs.unsnoc,
LazyDefs.null,
LazyDefs.head,
LazyDefs.last,
LazyDefs.tail,
LazyDefs.init,
)
where
import qualified Deque.Lazy.Defs as LazyDefs
import Deque.Prelude
import qualified Deque.Strict.Defs as StrictDefs
-- | Convert strict deque to lazy deque.
fromStrict :: StrictDefs.Deque a -> LazyDefs.Deque a
fromStrict (StrictDefs.Deque consList snocList) = LazyDefs.Deque (toList consList) (toList snocList)
-- | Convert lazy deque to strict deque.
toStrict :: LazyDefs.Deque a -> StrictDefs.Deque a
toStrict (LazyDefs.Deque consList snocList) = StrictDefs.Deque (fromList consList) (fromList snocList)
|