Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
dph
Commits
8e77dee3
Commit
8e77dee3
authored
Mar 27, 2007
by
rl@cse.unsw.edu.au
Browse files
Rewrite stream concatenation
parent
58717f1a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Data/Array/Parallel/Stream/Flat/Basics.hs
View file @
8e77dee3
...
...
@@ -19,7 +19,7 @@ module Data.Array.Parallel.Stream.Flat.Basics (
)
where
import
Data.Array.Parallel.Base
(
(
:*:
)(
..
),
MaybeS
(
..
),
Box
(
..
))
(
:*:
)(
..
),
MaybeS
(
..
),
EitherS
(
..
),
Box
(
..
))
import
Data.Array.Parallel.Stream.Flat.Stream
-- | Empty stream
...
...
@@ -84,19 +84,20 @@ replicateEachS n (Stream next s _) =
--
(
+++
)
::
Stream
a
->
Stream
a
->
Stream
a
{-# INLINE [1] (+++) #-}
Stream
next1
s
m
+++
Stream
next2
t
n
=
Stream
next
(
True
:*:
s
:*:
t
)
(
m
+
n
)
Stream
next1
s
1
n1
+++
Stream
next2
s2
n
2
=
Stream
next
(
LeftS
s1
)
(
n1
+
n2
)
where
{-# INLINE next #-}
next
(
True
:*:
s
:*:
t
)
=
case
next1
s
of
Done
->
Skip
(
False
:*:
s
:*:
t
)
Skip
s'
->
Skip
(
True
:*:
s'
:*:
t
)
Yield
x
s'
->
Yield
x
(
True
:*:
s'
:*:
t
)
next
(
False
:*:
s
:*:
t
)
=
case
next2
t
of
Done
->
Done
Skip
t'
->
Skip
(
False
:*:
s
:*:
t'
)
Yield
x
t'
->
Yield
x
(
False
:*:
s
:*:
t'
)
next
(
LeftS
s1
)
=
case
next1
s1
of
Done
->
Skip
(
RightS
s2
)
Skip
s1'
->
Skip
(
LeftS
s1'
)
Yield
x
s1'
->
Yield
x
(
LeftS
s1'
)
next
(
RightS
s2
)
=
case
next2
s2
of
Done
->
Done
Skip
s2'
->
Skip
(
RightS
s2'
)
Yield
x
s2'
->
Yield
x
(
RightS
s2'
)
-- | Indexing
-- ----------
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment