pipes-protolude (empty) → 0.1.0.0
raw patch · 14 files changed
+551/−0 lines, 14 filesdep +asyncdep +basedep +deepseqsetup-changed
Dependencies added: async, base, deepseq, exceptions, foldl, free, mtl, pipes, pipes-concurrency, pipes-extras, pipes-group, pipes-parse, pipes-protolude, pipes-safe, pipes-text, text-show, transformers
Files
- LICENSE +30/−0
- Setup.hs +2/−0
- app/Main.hs +6/−0
- pipes-protolude.cabal +67/−0
- src/Pipes/Base.hs +80/−0
- src/Pipes/Data/Conversion.hs +22/−0
- src/Pipes/Debug.hs +38/−0
- src/Pipes/Ecosystem.hs +130/−0
- src/Pipes/Monad.hs +39/−0
- src/Pipes/Protolude.hs +19/−0
- src/Pipes/Show.hs +12/−0
- src/Pipes/Temporary.hs +16/−0
- src/Pipes/Transformers.hs +88/−0
- test/Spec.hs +2/−0
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright Author name here (c) 2016++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Author name here nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ app/Main.hs view
@@ -0,0 +1,6 @@+module Main where++import Pipes.Protolude++main :: IO ()+main = return ()
+ pipes-protolude.cabal view
@@ -0,0 +1,67 @@+name: pipes-protolude+version: 0.1.0.0+synopsis: Alternate Prelude for the pipes ecosystem+description: Please see README.md+homepage: https://github.com/mckeankylej/pipes-protolude#readme+license: BSD3+license-file: LICENSE+author: Kyle McKean+maintainer: mckean.kylej@gmail.com+copyright: 2016 Kyle McKean+category: Pipes+build-type: Simple+cabal-version: >=1.10++library+ hs-source-dirs: src+ ghc-options: -Wall+ exposed-modules: Pipes.Protolude+ , Pipes.Base+ , Pipes.Show+ , Pipes.Debug+ , Pipes.Data.Conversion+ , Pipes.Monad+ , Pipes.Transformers+ , Pipes.Temporary+ , Pipes.Ecosystem+ build-depends: base >= 4.7 && < 5+ , text-show >= 2.1.2 && < 3.0.1+ , deepseq >= 1.4+ , mtl >= 2.2+ , transformers >= 0.4+ , async+ , foldl >= 1.2.1+ , free >= 4.12+ , pipes >= 4.1.9+ , pipes-concurrency >= 2.0.6+ , pipes-extras >= 1.0.3+ , pipes-group >= 1.0.4+ , pipes-safe >= 2.2.4+ , exceptions >= 0.8.2.1+ , pipes-parse >= 3.0+ , pipes-text >= 0.0.2.3+ default-language: Haskell2010+ default-extensions: NoImplicitPrelude++executable pipes-protolude-exe+ hs-source-dirs: app+ main-is: Main.hs+ ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N+ build-depends: base+ , pipes-protolude+ default-language: Haskell2010+ default-extensions: NoImplicitPrelude++test-suite pipes-protolude-test+ type: exitcode-stdio-1.0+ hs-source-dirs: test+ main-is: Spec.hs+ build-depends: base+ , pipes-protolude+ ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N+ default-language: Haskell2010+ default-extensions: NoImplicitPrelude++source-repository head+ type: git+ location: https://github.com/mckeankylej/pipes-protolude
+ src/Pipes/Base.hs view
@@ -0,0 +1,80 @@+module Pipes.Base (+ module X,+ String,+ FilePath+ ) where++-- Base Types --++import Data.Int as X+import Data.Bits as X+import Data.Word as X+import Data.Bool as X+import Data.Char as X (Char,ord,chr)+import Data.Maybe as X hiding (fromJust)+import Data.Either as X+import Data.Tuple as X++import Data.Function as X (+ const,+ flip,+ ($),+ (&),+ fix,+ on)+import Control.Category as X (+ Category(..),+ id,+ (.))++-- Type Classes --++import Data.Eq as X+import Data.Ord as X+import Data.Monoid as X hiding (mconcat)+import Data.Functor.Identity as X+import Data.Functor as X (+ Functor(..)+ , ($>)+ , void+ )+import Data.Bifunctor as X+import Control.Applicative as X++-- Deepseq --++import Control.DeepSeq as X (+ NFData(..)+ , ($!!)+ , deepseq+ , force+ )++-- Base GHC types --++import GHC.IO as X (IO)+import GHC.Num as X+import GHC.Real as X+import GHC.Float as X+import GHC.Show as X+import GHC.Exts as X (+ Constraint+ , Ptr+ , FunPtr+ , the+ )++-- Generics+import GHC.Generics as X (Generic(..))++-- ST+import Control.Monad.ST as X++-- Concurrency and Parallelism+-- import Control.Exception as X hiding (Handler)+-- TODO: This doesnt opperate well with the pipes ecosystem does pipes-safe fill the need of this package?+import Control.Concurrent as X hiding (yield)+import Control.Concurrent.Async as X --TODO: Investigate if safe or nonsafe is needed++type String = [Char] -- BANSHED UNLOVED HELL SPAWN+type FilePath = String
+ src/Pipes/Data/Conversion.hs view
@@ -0,0 +1,22 @@+module Pipes.Data.Conversion where++import Prelude (const)++import Data.Maybe (Maybe(..),maybe)+import Data.Either (Either(..),either)+import Data.Monoid++leftToMaybe :: Either l r -> Maybe l+leftToMaybe = either Just (const Nothing)++rightToMaybe :: Either l r -> Maybe r+rightToMaybe = either (const Nothing) Just++maybeToRight :: l -> Maybe r -> Either l r+maybeToRight l = maybe (Left l) Right++maybeToLeft :: r -> Maybe l -> Either l r+maybeToLeft r = maybe (Right r) Left++maybeToEither :: Monoid b => (a -> b) -> Maybe a -> b+maybeToEither = maybe mempty
+ src/Pipes/Debug.hs view
@@ -0,0 +1,38 @@+module Pipes.Debug where++import qualified Prelude as P++import qualified Debug.Trace as T++{-# WARNING undefined "'undefined' remains in code" #-}+undefined :: a+undefined = P.undefined++{-# WARNING error "'error' remains in code" #-}+error :: P.String -> a+error = P.error++{-# WARNING trace "'trace' remains in code" #-}+trace :: P.String -> a -> a+trace = T.trace++{-# WARNING traceShow "'traceShow' remains in code" #-}+traceShow :: P.Show a => a -> a+traceShow a = T.trace (P.show a) a++{-# WARNING traceShowM "'traceShowM' remains in code" #-}+traceShowM :: (P.Show a, P.Monad m) => a -> m ()+traceShowM a = T.traceM (P.show a)++{-# WARNING traceM "'traceM' remains in code" #-}+traceM :: P.Monad m => P.String -> m ()+traceM = T.traceM++{-# WARNING traceIO "'traceIO' remains in code" #-}+traceIO :: P.String -> P.IO ()+traceIO = T.traceIO++{-# WARNING notImplemented "'notImplemented' remains in code" #-}+notImplemented :: a+notImplemented = P.error "Not implemented"+
+ src/Pipes/Ecosystem.hs view
@@ -0,0 +1,130 @@+module Pipes.Ecosystem (+ module X+ ) where++import Pipes as X+import Pipes.Lift as X hiding (catchError)+-- Import Pipes.Prelude banshing string based functions+import Pipes.Prelude as X (+ repeatM,+ replicateM,+ unfoldr,+ drain,+ map,+ mapM,+ sequence,+ mapFoldable,+ filter,+ filterM,+ take,+ takeWhile,+ takeWhile',+ drop,+ dropWhile,+ concat,+ chain,+ seq,+ loop,+ zip,+ zipWith,+ tee+ )+import Pipes.Concurrent as X hiding (+ Unbounded,+ Bounded,+ Single,+ Latest,+ Newest,+ New+ )+import Control.Foldl as X hiding (+ fold,+ foldM,+ scan,+ Handler, -- Not only does this conflict with execptions which are a needed+ -- feature of a prelude I feel it doesnt have enough of a use case+ -- to merit importing+ handles,+ HandlerM,+ handlesM,+ folded,+ filtered+ )++import Pipes.Extras as X (+ fold,+ foldM,+ scan,+ scanM+ )++import Pipes.Group as X++import Control.Monad.Trans.Free as X++import Pipes.Safe as X (+ SafeT,+ runSafeT,+ runSafeP,+ ReleaseKey,+ MonadSafe(..),+ onException,+ finally,+ bracket,+ bracket_,+ bracketOnError+ )+import Control.Monad.Catch as X+ ( MonadCatch(..)+ , MonadThrow(..)+ , MonadMask(..)+ , mask_+ , uninterruptibleMask_+ , catchAll+ , catchIOError+ , catchJust+ , catchIf+ , Handler(..)+ , catches+ , handle+ , handleAll+ , handleIOError+ , handleJust+ , handleIf+ , try+ , tryJust+ , Exception(..)+ , SomeException+ )++import Pipes.Text as X hiding (+ map,+ concatMap,+ take,+ takeWhile,+ filter,+ scan,+ toLazy, -- We dont like lazy text and bytestrings here in pipes world+ toLazyM,+ head,+ last,+ null,+ length,+ any,+ all,+ maximum,+ minimum,+ find,+ index,+ drop,+ dropWhile,+ groups,+ groupsBy,+ groupsBy',+ chunksOf+ )+import Pipes.Text.IO as X++import Pipes.Text.Encoding as X++import Pipes.Parse as X hiding (span,splitAt,groupBy,group)
+ src/Pipes/Monad.hs view
@@ -0,0 +1,39 @@+module Pipes.Monad (+ Monad(..)+ , MonadPlus(..)++ , (=<<)+ , (>=>)+ , (<=<)+ , forever++ , join+ , mfilter++ , guard+ , when+ , unless++ , liftM'+ , liftM2'++ , ap+ , (<$!>)+ ) where++import Prelude (seq)+-- import Pipes.Base (seq)++import Control.Monad++liftM' :: Monad m => (a -> b) -> m a -> m b+liftM' = (<$!>)+{-# INLINE liftM' #-}++liftM2' :: (Monad m) => (a -> b -> c) -> m a -> m b -> m c+liftM2' f a b = do+ x <- a+ y <- b+ let z = f x y+ z `seq` return z+{-# INLINE liftM2' #-}
+ src/Pipes/Protolude.hs view
@@ -0,0 +1,19 @@+module Pipes.Protolude (+ module X+ ) where++import Pipes.Ecosystem as X -- Where the magic happens++import Pipes.Base as X++import Pipes.Show as X++import Pipes.Debug as X++import Pipes.Data.Conversion as X++import Pipes.Monad as X++import Pipes.Transformers as X++-- import Pipes.Temporary as X
+ src/Pipes/Show.hs view
@@ -0,0 +1,12 @@+module Pipes.Show (+ module X,+ print+ )where++import TextShow as X+import TextShow.Generic as X++import Pipes++print :: (MonadIO m,TextShow a) => Consumer a m r+print = for cat (\a -> liftIO (printT a))
+ src/Pipes/Temporary.hs view
@@ -0,0 +1,16 @@+module Pipes.Temporary where++import Prelude++import Pipes+import Pipes.Internal++import Control.Monad.Except++exceptP+ :: Monad m+ => Proxy a' a b' b m (Either e r)+ -> Proxy a' a b' b (ExceptT e m) r+exceptP p = do+ x <- unsafeHoist lift p+ lift $ ExceptT (return x)
+ src/Pipes/Transformers.hs view
@@ -0,0 +1,88 @@+module Pipes.Transformers (+ module X+ ) where++import Control.Monad.Fix as X hiding (fix)+import Control.Monad.Trans.Class as X+import Control.Monad.IO.Class as X++import Control.Monad.Except as X (+ MonadError(..),+ Except,+ ExceptT(..),+ runExcept,+ runExceptT,+ mapExcept,+ mapExceptT,+ withExcept,+ withExceptT+ )++import Control.Monad.Trans.Maybe as X (+ MaybeT(..),+ mapMaybeT,+ maybeToExceptT,+ exceptToMaybeT+ )++import Control.Monad.Reader as X (+ MonadReader(..),+ asks,+ Reader,+ ReaderT(..),+ runReader,+ mapReader,+ mapReaderT,+ withReader,+ withReaderT+ )++import Control.Monad.State.Strict as X (+ MonadState(..),+ State,+ StateT,+ modify,+ modify',+ gets,+ runState,+ runStateT,+ evalState,+ evalStateT,+ execState,+ execStateT,+ mapState,+ mapStateT,+ withState,+ withStateT+ )++import Control.Monad.Writer.Strict as X (+ MonadWriter(..),+ listens,+ censor,+ Writer,+ WriterT,+ runWriter,+ runWriterT,+ execWriter,+ execWriterT,+ mapWriter,+ mapWriterT+ )++import Control.Monad.RWS.Strict as X (+ RWS,+ RWST(..),+ rws,+ runRWS,+ runRWST,+ evalRWS,+ evalRWST,+ execRWS,+ execRWST,+ mapRWS,+ mapRWST,+ withRWS,+ withRWST+ )+
+ test/Spec.hs view
@@ -0,0 +1,2 @@+main :: IO ()+main = putStrLn "Test suite not yet implemented"