module Control.Distributed.Process.Internal.StrictList
( StrictList(..)
, append
, foldr
) where
import Prelude hiding (length, reverse, foldr)
data StrictList a
= Cons !a !(StrictList a)
| Nil
| Snoc !(StrictList a) !a
| Append !(StrictList a) !(StrictList a)
append :: StrictList a -> StrictList a -> StrictList a
append :: forall a. StrictList a -> StrictList a -> StrictList a
append StrictList a
Nil StrictList a
l = StrictList a
l
append StrictList a
l StrictList a
Nil = StrictList a
l
append StrictList a
l1 StrictList a
l2 = StrictList a
l1 StrictList a -> StrictList a -> StrictList a
forall a. StrictList a -> StrictList a -> StrictList a
`Append` StrictList a
l2
foldr :: (a -> b -> b) -> b -> StrictList a -> b
foldr :: forall a b. (a -> b -> b) -> b -> StrictList a -> b
foldr a -> b -> b
f b
c0 StrictList a
xs0 = StrictList a -> b -> b
go StrictList a
xs0 b
c0
where go :: StrictList a -> b -> b
go StrictList a
Nil b
c = b
c
go (Cons a
x StrictList a
xs) b
c = a -> b -> b
f a
x (StrictList a -> b -> b
go StrictList a
xs b
c)
go (Snoc StrictList a
xs a
x) b
c = StrictList a -> b -> b
go StrictList a
xs (a -> b -> b
f a
x b
c)
go (Append StrictList a
xs StrictList a
ys) b
c = StrictList a -> b -> b
go StrictList a
xs (StrictList a -> b -> b
go StrictList a
ys b
c)