packages feed

monad-interleave (empty) → 0.1

raw patch · 4 files changed

+92/−0 lines, 4 filesdep +basebuild-type:Customsetup-changed

Dependencies added: base

Files

+ Control/Monad/Interleave.hs view
@@ -0,0 +1,35 @@+-----------------------------------------------------------------------------+-- |+-- Module     : Control.Monad.Interleave+-- Copyright  : Copyright (c) , Patrick Perry <patperry@stanford.edu>+-- License    : BSD3+-- Maintainer : Patrick Perry <patperry@stanford.edu>+-- Stability  : experimental+--+-- Monads with an unsaveInterleaveIO-like operation.+--++module Control.Monad.Interleave (+    MonadInterleave(..),+    ) where++import Control.Monad.ST+import qualified Control.Monad.ST.Lazy as Lazy+import System.IO.Unsafe++-- | Monads that have an operation like 'unsafeInterleaveIO'.+class Monad m => MonadInterleave m where+    -- | Get the baton from the monad without doing any computation.+    unsafeInterleave :: m a -> m a++instance MonadInterleave IO where+    unsafeInterleave = unsafeInterleaveIO+    {-# INLINE unsafeInterleave #-}+    +instance MonadInterleave (ST s) where+    unsafeInterleave = unsafeInterleaveST+    {-# INLINE unsafeInterleave #-}+    +instance MonadInterleave (Lazy.ST s) where+    unsafeInterleave = Lazy.unsafeInterleaveST+    {-# INLINE unsafeInterleave #-}
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) Patrick Perry <patperry@stanford.edu> 2009++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions+are met:++1. Redistributions of source code must retain the above copyright+   notice, this list of conditions and the following disclaimer.++2. 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.++3. Neither the name of the author nor the names of his contributors+   may be used to endorse or promote products derived from this software+   without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.lhs view
@@ -0,0 +1,6 @@+#!/usr/bin/env runhaskell+> import Distribution.Simple+> import System.Cmd+>+> main = defaultMain+>
+ monad-interleave.cabal view
@@ -0,0 +1,21 @@+name:            monad-interleave+version:         0.1+homepage:        http://github.com/patperry/monad-interleave+synopsis:        Monads with an unsaveInterleaveIO-like operation.+description:+    A type class for monads that have an \"unsafeInterleave\" operation.+    Instances are provided for IO and both strict and lazy ST.+category:        Monads+license:         BSD3+license-file:    LICENSE+copyright:       (c) 2009. Patrick Perry <patperry@stanford.edu>+author:          Patrick Perry+maintainer:      Patrick Perry <patperry@stanford.edu>+cabal-version: >= 1.2.0+build-type:      Custom+tested-with:     GHC ==6.10.1++library+    exposed-modules: Control.Monad.Interleave+    build-depends:   base+    ghc-options:     -Wall