Skip to content

Commit e8a9b21

Browse files
committed
Extract streaming functionality into vector-stream package. Fix haskell#355
1 parent d578a56 commit e8a9b21

File tree

6 files changed

+25
-22
lines changed

6 files changed

+25
-22
lines changed

cabal.project

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
packages: vector/vector.cabal
1+
packages:
2+
vector
3+
vector-stream

vector-stream/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The `vector` package [![Build Status](https://travis-ci.org/haskell/vector.png?branch=master)](https://travis-ci.org/haskell/vector)
22
====================
33

4-
An efficient implementation monadic streams used for fusion in `vector` package
4+
An efficient implementation of monadic streams used for fusion in `vector` package
55

66
See [`vector-stream` on Hackage](http://hackage.haskell.org/package/vector-stream) for more information.

vector-stream/changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Changes in version 0.1.0.0
22

3-
* Initial move from `vector`, which will depend on this package starting with
3+
* Initial move from `vector`, which will depend on this package starting from
44
`vector-0.13.0.0`
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
-- |
2+
-- Module : Data.Vector.Fusion.Stream.Monadic
3+
-- Copyright : (c) Roman Leshchinskiy 2008-2010
4+
-- License : BSD-style
5+
--
6+
-- Maintainer : Roman Leshchinskiy <[email protected]>
7+
-- Stability : experimental
8+
-- Portability : non-portable
9+
--
10+
-- Monadic stream combinators.
11+
--
12+
13+
module Data.Vector.Fusion.Stream.Monadic
14+
( module Data.Stream.Monadic
15+
) where
16+
17+
import Data.Stream.Monadic

vector/src/Data/Vector/Fusion/Util.hs

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{-# LANGUAGE CPP #-}
21
-- |
32
-- Module : Data.Vector.Fusion.Util
43
-- Copyright : (c) Roman Leshchinskiy 2009
@@ -17,6 +16,8 @@ module Data.Vector.Fusion.Util (
1716
delay_inline, delayed_min
1817
) where
1918

19+
import Data.Stream.Monadic (Box(..), liftBox)
20+
2021
-- | Identity monad
2122
newtype Id a = Id { unId :: a }
2223

@@ -31,24 +32,6 @@ instance Monad Id where
3132
return = pure
3233
Id x >>= f = f x
3334

34-
-- | Box monad
35-
data Box a = Box { unBox :: a }
36-
37-
instance Functor Box where
38-
fmap f (Box x) = Box (f x)
39-
40-
instance Applicative Box where
41-
pure = Box
42-
Box f <*> Box x = Box (f x)
43-
44-
instance Monad Box where
45-
return = pure
46-
Box x >>= f = f x
47-
48-
liftBox :: Monad m => Box a -> m a
49-
liftBox (Box a) = return a
50-
{-# INLINE liftBox #-}
51-
5235
-- | Delay inlining a function until late in the game (simplifier phase 0).
5336
delay_inline :: (a -> b) -> a -> b
5437
{-# INLINE [0] delay_inline #-}

vector/vector.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ Library
138138
, primitive >= 0.6.4.0 && < 0.8
139139
, ghc-prim >= 0.2 && < 0.8
140140
, deepseq >= 1.1 && < 1.5
141+
, vector-stream >= 0.1 && < 0.2
141142

142143
Ghc-Options: -O2 -Wall
143144

0 commit comments

Comments
 (0)