Skip to content

Commit 00b7dba

Browse files
committed
Clean up trailing whitespace
1 parent 8115288 commit 00b7dba

2 files changed

Lines changed: 45 additions & 45 deletions

File tree

src/Streaming/Prelude.hs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
articulated in the latter two modules. Because we dispense with piping and
99
conduiting, the distinction between all of these modules collapses. Some things are
1010
lost but much is gained: on the one hand, everything comes much closer to ordinary
11-
beginning Haskell programming and, on the other, acquires the plasticity of programming
11+
beginning Haskell programming and, on the other, acquires the plasticity of programming
1212
directly with a general free monad type. The leading type, @Stream (Of a) m r@ is chosen to permit an api
1313
that is as close as possible to that of @Data.List@ and the @Prelude@.
1414
@@ -64,7 +64,7 @@ module Streaming.Prelude (
6464
, stdinLn
6565
, readLn
6666
, fromHandle
67-
, readFile
67+
, readFile
6868
, iterate
6969
, iterateM
7070
, repeat
@@ -76,7 +76,7 @@ module Streaming.Prelude (
7676
, enumFrom
7777
, enumFromThen
7878
, unfoldr
79-
79+
8080

8181

8282
-- * Consuming streams of elements
@@ -86,7 +86,7 @@ module Streaming.Prelude (
8686
, mapM_
8787
, print
8888
, toHandle
89-
, writeFile
89+
, writeFile
9090
, effects
9191
, erase
9292
, drained
@@ -229,7 +229,7 @@ module Streaming.Prelude (
229229
, merge
230230
, mergeOn
231231
, mergeBy
232-
232+
233233
-- * Maybes
234234
-- $maybes
235235
, catMaybes
@@ -878,7 +878,7 @@ filter thePred = loop where
878878
else loop as
879879
{-# INLINE filter #-} -- ~ 10% faster than INLINABLE in simple bench
880880

881-
881+
882882
-- ---------------
883883
-- filterM
884884
-- ---------------
@@ -1709,7 +1709,7 @@ reread step s = loop where
17091709
Just a -> return (Step (a :> loop))
17101710
{-# INLINABLE reread #-}
17111711

1712-
{-| Strict left scan, streaming, e.g. successive partial results. The seed
1712+
{-| Strict left scan, streaming, e.g. successive partial results. The seed
17131713
is yielded first, before any action of finding the next element is performed.
17141714
17151715
@@ -1731,13 +1731,13 @@ reread step s = loop where
17311731
-}
17321732
scan :: Monad m => (x -> a -> x) -> x -> (x -> b) -> Stream (Of a) m r -> Stream (Of b) m r
17331733
scan step begin done str = Step (done begin :> loop begin str)
1734-
where
1734+
where
17351735
loop !acc stream = do
17361736
case stream of
17371737
Return r -> Return r
17381738
Effect m -> Effect (fmap (loop acc) m)
1739-
Step (a :> rest) ->
1740-
let !acc' = step acc a
1739+
Step (a :> rest) ->
1740+
let !acc' = step acc a
17411741
in Step (done acc' :> loop acc' rest)
17421742
{-# INLINABLE scan #-}
17431743

@@ -1758,7 +1758,7 @@ scanM :: Monad m => (x -> a -> m x) -> m x -> (x -> m b) -> Stream (Of a) m r ->
17581758
scanM step begin done str = Effect $ do
17591759
x <- begin
17601760
b <- done x
1761-
return (Step (b :> loop x str))
1761+
return (Step (b :> loop x str))
17621762
where
17631763
loop !x stream = case stream of -- note we have already yielded from x
17641764
Return r -> Return r
@@ -2055,7 +2055,7 @@ toList_ = fold_ (\diff a ls -> diff (a: ls)) id (\diff -> diff [])
20552055
20562056
> mapped toList :: Stream (Stream (Of a)) m r -> Stream (Of [a]) m
20572057
2058-
Like 'toList_', 'toList' breaks streaming; unlike 'toList_' it /preserves the return value/
2058+
Like 'toList_', 'toList' breaks streaming; unlike 'toList_' it /preserves the return value/
20592059
and thus is frequently useful with e.g. 'mapped'
20602060
20612061
>>> S.print $ mapped S.toList $ chunksOf 3 $ each [1..9]
@@ -2068,7 +2068,7 @@ t<Enter>
20682068
["s","t"]
20692069
u<Enter>
20702070
v<Enter>
2071-
["u","v"]
2071+
["u","v"]
20722072
-}
20732073
toList :: Monad m => Stream (Of a) m r -> m (Of [a] r)
20742074
toList = fold (\diff a ls -> diff (a: ls)) id (\diff -> diff [])
@@ -2300,7 +2300,7 @@ stdinLn = fromHandle IO.stdin
23002300
-}
23012301

23022302
readLn :: (MonadIO m, Read a) => Stream (Of a) m ()
2303-
readLn = loop where
2303+
readLn = loop where
23042304
loop = do
23052305
eof <- liftIO IO.isEOF
23062306
unless eof $ do
@@ -2846,7 +2846,7 @@ mergeBy cmp = loop
28462846
LT -> Step (a :> loop rest0 str1)
28472847
EQ -> Step (a :> loop rest0 str1) -- left-biased
28482848
GT -> Step (b :> loop str0 rest1)
2849-
{-# INLINABLE mergeBy #-}
2849+
{-# INLINABLE mergeBy #-}
28502850

28512851
{- $maybes
28522852
These functions discard the 'Nothing's that they encounter. They are analogous
@@ -2855,7 +2855,7 @@ mergeBy cmp = loop
28552855

28562856
{-| The 'catMaybes' function takes a 'Stream' of 'Maybe's and returns
28572857
a 'Stream' of all of the 'Just' values. 'concat' has the same behavior,
2858-
but is more general; it works for any foldable container type.
2858+
but is more general; it works for any foldable container type.
28592859
-}
28602860
catMaybes :: Monad m => Stream (Of (Maybe a)) m r -> Stream (Of a) m r
28612861
catMaybes = loop where
@@ -2870,7 +2870,7 @@ catMaybes = loop where
28702870
{-| The 'mapMaybe' function is a version of 'map' which can throw out elements. In particular,
28712871
the functional argument returns something of type @'Maybe' b@. If this is 'Nothing', no element
28722872
is added on to the result 'Stream'. If it is @'Just' b@, then @b@ is included in the result 'Stream'.
2873-
2873+
28742874
-}
28752875
mapMaybe :: Monad m => (a -> Maybe b) -> Stream (Of a) m r -> Stream (Of b) m r
28762876
mapMaybe phi = loop where
@@ -2882,9 +2882,9 @@ mapMaybe phi = loop where
28822882
Just b -> Step (b :> loop snext)
28832883
{-# INLINABLE mapMaybe #-}
28842884

2885-
{-| 'slidingWindow' accumulates the first @n@ elements of a stream,
2885+
{-| 'slidingWindow' accumulates the first @n@ elements of a stream,
28862886
update thereafter to form a sliding window of length @n@.
2887-
It follows the behavior of the slidingWindow function in
2887+
It follows the behavior of the slidingWindow function in
28882888
<https://hackage.haskell.org/package/conduit-combinators-1.0.4/docs/Data-Conduit-Combinators.html#v:slidingWindow conduit-combinators>.
28892889
28902890
>>> S.print $ slidingWindow 4 $ S.each "123456"
@@ -2894,25 +2894,25 @@ fromList "3456"
28942894
28952895
-}
28962896

2897-
slidingWindow :: Monad m
2898-
=> Int
2899-
-> Stream (Of a) m b
2897+
slidingWindow :: Monad m
2898+
=> Int
2899+
-> Stream (Of a) m b
29002900
-> Stream (Of (Seq.Seq a)) m b
2901-
slidingWindow n = setup (max 1 n :: Int) mempty
2902-
where
2903-
window !sequ str = do
2904-
e <- lift (next str)
2905-
case e of
2901+
slidingWindow n = setup (max 1 n :: Int) mempty
2902+
where
2903+
window !sequ str = do
2904+
e <- lift (next str)
2905+
case e of
29062906
Left r -> return r
2907-
Right (a,rest) -> do
2907+
Right (a,rest) -> do
29082908
yield (sequ Seq.|> a)
29092909
window (Seq.drop 1 $ sequ Seq.|> a) rest
29102910
setup 0 !sequ str = do
2911-
yield sequ
2912-
window (Seq.drop 1 sequ) str
2913-
setup m sequ str = do
2914-
e <- lift $ next str
2915-
case e of
2911+
yield sequ
2912+
window (Seq.drop 1 sequ) str
2913+
setup m sequ str = do
2914+
e <- lift $ next str
2915+
case e of
29162916
Left r -> yield sequ >> return r
29172917
Right (x,rest) -> setup (m-1) (sequ Seq.|> x) rest
29182918
{-# INLINABLE slidingWindow #-}

streaming.cabal

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ cabal-version: >=1.10
44
build-type: Simple
55
synopsis: an elementary streaming prelude and general stream type.
66

7-
description: This package contains two modules, <http://hackage.haskell.org/package/streaming/docs/Streaming.html Streaming>
7+
description: This package contains two modules, <http://hackage.haskell.org/package/streaming/docs/Streaming.html Streaming>
88
and <http://hackage.haskell.org/package/streaming/docs/Streaming-Prelude.html Streaming.Prelude>.
99
The principal module, <http://hackage.haskell.org/package/streaming-0.1.4.3/docs/Streaming-Prelude.html Streaming.Prelude>, exports an elementary streaming prelude focused on
1010
a simple \"source\" or \"producer\" type, namely @Stream (Of a) m r@.
1111
This is a sort of effectful version of
1212
@([a],r)@ in which successive elements of type @a@ arise from some sort of monadic
13-
action before the succession ends with a value of type @r@.
13+
action before the succession ends with a value of type @r@.
1414
Everything in the library is organized to make
1515
programming with this type as simple as possible,
1616
by the simple expedient of making it as close to @Prelude@
@@ -21,25 +21,25 @@ description: This package contains two modules, <http://hackage.haskell.
2121
> 1<Enter>
2222
> 2<Enter>
2323
> 3<Enter>
24-
> 6 :> ()
24+
> 6 :> ()
2525
.
2626
sums the first three valid integers from user input. Similarly,
2727
.
28-
> >>> S.stdoutLn $ S.map (map toUpper) $ S.take 2 S.stdinLn
28+
> >>> S.stdoutLn $ S.map (map toUpper) $ S.take 2 S.stdinLn
2929
> hello<Enter>
3030
> HELLO
3131
> world!<Enter>
3232
> WORLD!
3333
.
3434
upper-cases the first two lines from stdin as they arise,
3535
and sends them to stdout. And so on,
36-
with filtering, mapping, breaking, chunking, zipping, unzipping, replicating
37-
and so forth:
36+
with filtering, mapping, breaking, chunking, zipping, unzipping, replicating
37+
and so forth:
3838
we program with streams of @Int@s or @String@s directly as
3939
if they constituted something like a list. That's because streams really do constitute something
40-
like a list, and the associated operations can mostly have the same names.
41-
(A few, like @reverse@, don't stream and thus disappear;
42-
others like @unzip@ are here given properly streaming formulation for the first time.)
40+
like a list, and the associated operations can mostly have the same names.
41+
(A few, like @reverse@, don't stream and thus disappear;
42+
others like @unzip@ are here given properly streaming formulation for the first time.)
4343
And we everywhere
4444
oppose \"extracting a pure list from IO\",
4545
which is the origin of typical Haskell memory catastrophes.
@@ -53,7 +53,7 @@ description: This package contains two modules, <http://hackage.haskell.
5353
.
5454
> main = mapM newIORef [1..10^8::Int] >>= mapM readIORef >>= mapM_ print
5555
.
56-
The new user notices that this exhausts memory, and worries about the efficiency of Haskell @IORefs@.
56+
The new user notices that this exhausts memory, and worries about the efficiency of Haskell @IORefs@.
5757
But of course it exhausts memory! Look what it says!
5858
The problem is immediately cured by writing
5959
.
@@ -100,7 +100,7 @@ description: This package contains two modules, <http://hackage.haskell.
100100
elementary streaming library - since one possesses @Stream ((,) a) m r@
101101
or equivalently @Stream (Of a) m r@. This
102102
is the type of a \'generator\' or \'producer\' or \'source\' or whatever
103-
you call an effectful stream of items.
103+
you call an effectful stream of items.
104104
/The present Streaming.Prelude is thus the simplest streaming library that can replicate anything like the API of the Prelude and Data.List/.
105105
.
106106
The emphasis of the library is on interoperation; for
@@ -117,7 +117,7 @@ description: This package contains two modules, <http://hackage.haskell.
117117
a complex framework, but in a way that integrates transparently with
118118
the rest of Haskell, using ideas - e.g. rank 2 types, which are here
119119
implicit or explicit in most mapping - that the user can carry elsewhere,
120-
rather than chaining her understanding to the curiosities of
120+
rather than chaining her understanding to the curiosities of
121121
a so-called streaming IO framework (as necessary as that is for certain purposes.)
122122
.
123123
See the

0 commit comments

Comments
 (0)