{-# LANGUAGE Safe #-}
module Data.DList
( DList
, empty
, singleton
, append
, toList
) where
newtype DList a = DList ([a] -> [a])
toList :: DList a -> [a]
toList :: DList a -> [a]
toList (DList [a] -> [a]
dl) = [a] -> [a]
dl []
singleton :: a -> DList a
singleton :: a -> DList a
singleton a
x = ([a] -> [a]) -> DList a
forall a. ([a] -> [a]) -> DList a
DList (a
xa -> [a] -> [a]
forall a. a -> [a] -> [a]
:)
empty :: DList a
empty :: DList a
empty = ([a] -> [a]) -> DList a
forall a. ([a] -> [a]) -> DList a
DList [a] -> [a]
forall a. a -> a
id
append :: DList a -> DList a -> DList a
append :: DList a -> DList a -> DList a
append (DList [a] -> [a]
xs) (DList [a] -> [a]
ys) = ([a] -> [a]) -> DList a
forall a. ([a] -> [a]) -> DList a
DList ([a] -> [a]
xs ([a] -> [a]) -> ([a] -> [a]) -> [a] -> [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [a] -> [a]
ys)