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