packages feed

arrows 0.2 → 0.3

raw patch · 4 files changed

+36/−74 lines, 4 filesdep +Streamsetup-changed

Dependencies added: Stream

Files

Control/Arrow/Transformer/Stream.hs view
@@ -26,7 +26,8 @@ import Control.Arrow.Internals import Control.Arrow.Operations import Control.Arrow.Transformer-import Data.Stream+import Data.Stream (Stream(..))+import qualified Data.Stream as Stream  -- | Arrows between streams. --@@ -38,11 +39,11 @@ 	arr f = Str (arr (fmap f)) 	Str f >>> Str g = Str (f >>> g) 	first (Str f) =-		Str (arr unzipStream >>> first f >>> arr (uncurry zipStream))+		Str (arr Stream.unzip >>> first f >>> arr (uncurry Stream.zip))  genmap :: Arrow a => a b c -> a (Stream b) (Stream c)-genmap f = arr (\xs -> (shd xs, stl xs)) >>>-		f *** genmap f >>> arr (uncurry Cons)+genmap f = arr (\xs -> (Stream.head xs, Stream.tail xs)) >>>+		f *** genmap f >>> arr (uncurry (Stream.Cons))  -- Caution: genmap is only a functor if *** for the base arrow is. -- (For Kleisli arrows, that would mean a commutative monad.)@@ -80,7 +81,7 @@  instance ArrowLoop a => ArrowLoop (StreamArrow a) where 	loop (Str f) =-		Str (loop (arr (uncurry zipStream) >>> f >>> arr unzipStream))+		Str (loop (arr (uncurry Stream.zip) >>> f >>> arr Stream.unzip))  instance ArrowPlus a => ArrowPlus (StreamArrow a) where 	Str f <+> Str g = Str (f <+> g)
− Data/Stream.hs
@@ -1,42 +0,0 @@--------------------------------------------------------------------------------- |--- Module      :  Data.Stream--- Copyright   :  (c) Ross Paterson 2003--- License     :  BSD-style (see the LICENSE file in the distribution)------ Maintainer  :  ross@soi.city.ac.uk--- Stability   :  experimental--- Portability :  portable------ Infinite sequences.--module Data.Stream where---- | An infinite sequence.-data Stream a = Cons {-		shd :: a,	-- ^ head of the stream-		stl :: Stream a -- ^ tail of the stream-	}--instance Functor Stream where-	fmap f xs = Cons (f (shd xs)) (fmap f (stl xs))--instance Monad Stream where-	return x = let return_x = Cons x return_x in return_x-	xs >>= f = Cons (shd (f (shd xs))) (stl xs >>= f)---- | Lazy zip of a pair of streams.-zipStream :: Stream a -> Stream b -> Stream (a, b)-zipStream xs ys = Cons (shd xs, shd ys) (zipStream (stl xs) (stl ys))---- | Lazy unzip of a pair of streams.-unzipStream :: Stream (a, b) -> (Stream a, Stream b)-unzipStream xys = (fmap fst xys, fmap snd xys)---- | An infinite sequence obtained by padding the list with 'undefined'.-listToStream :: [a] -> Stream a-listToStream = foldr Cons (error "listToStream")---- | The infinite list corresponding to a stream.-streamToList :: Stream a -> [a]-streamToList xs = shd xs : streamToList (stl xs)
Setup.hs view
@@ -1,2 +1,6 @@+module Main (main) where+ import Distribution.Simple++main :: IO () main = defaultMain
arrows.cabal view
@@ -1,28 +1,27 @@-Name:		arrows-Version:	0.2-Build-Depends:	base >= 2.0-License:	BSD3-license-file:	LICENSE-Author:		Ross Paterson <ross@soi.city.ac.uk>-Maintainer:	Ross Paterson <ross@soi.city.ac.uk>-Homepage:	http://www.haskell.org/arrows/-Synopsis:	Arrow classes and transformers-Description:-	Several classes that extend the Arrow class, and some transformers-	that implement or lift these classes.+Name:           arrows+Version:        0.3+Build-Depends:  base >= 2.0, Stream+Build-Type:     Simple+License:        BSD3+license-file:   LICENSE+Author:         Ross Paterson <ross@soi.city.ac.uk>+Maintainer:     Ross Paterson <ross@soi.city.ac.uk>+Homepage:       http://www.haskell.org/arrows/+Synopsis:       Arrow classes and transformers+Description:    Several classes that extend the Arrow class, and some+                transformers that implement or lift these classes. Exposed-Modules:-	Control.Arrow.Operations,-	Control.Arrow.Transformer.Automaton,-	Control.Arrow.Transformer.CoState,-	Control.Arrow.Transformer.Error,-	Control.Arrow.Transformer.State,-	Control.Arrow.Transformer.Static,-	Control.Arrow.Transformer.Stream,-	Control.Arrow.Transformer.Writer,-	Control.Arrow.Transformer.Reader,-	Control.Arrow.Transformer.All,-	Control.Arrow.Transformer,-	Data.Stream-Other-Modules:-        Control.Arrow.Internals-Extensions: MultiParamTypeClasses, UndecidableInstances+                Control.Arrow.Operations+                Control.Arrow.Transformer.Automaton+                Control.Arrow.Transformer.CoState+                Control.Arrow.Transformer.Error+                Control.Arrow.Transformer.State+                Control.Arrow.Transformer.Static+                Control.Arrow.Transformer.Stream+                Control.Arrow.Transformer.Writer+                Control.Arrow.Transformer.Reader+                Control.Arrow.Transformer.All+                Control.Arrow.Transformer+Other-Modules:  Control.Arrow.Internals+Extensions:     MultiParamTypeClasses, FunctionalDependencies,+                UndecidableInstances