module StreamProcIO where
import SP

class StreamProcIO sp where -- or: SPIO SP_IO SpIO SpIo ?
  put :: o -> sp i o -> sp i o
  get :: (i -> sp i o) -> sp i o
  end :: sp i o -- null?

puts :: t o -> sp i o -> sp i o
puts t o
xs sp i o
sp = (o -> sp i o -> sp i o) -> sp i o -> t o -> sp i o
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr o -> sp i o -> sp i o
forall (sp :: * -> * -> *) o i.
StreamProcIO sp =>
o -> sp i o -> sp i o
put sp i o
sp t o
xs

instance StreamProcIO SP where
  put :: o -> SP i o -> SP i o
put = o -> SP i o -> SP i o
forall a b. b -> SP a b -> SP a b
PutSP
  get :: (i -> SP i o) -> SP i o
get = (i -> SP i o) -> SP i o
forall i o. (i -> SP i o) -> SP i o
GetSP
  end :: SP i o
end = SP i o
forall i o. SP i o
NullSP