summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTonyMorris <>2011-01-10 01:19:07 (GMT)
committerLuite Stegeman <luite@luite.com>2011-01-10 01:19:07 (GMT)
commite709034e391d21b29401fc001c8258eb0f40eb31 (patch)
treea0306b808abe9e44fb7a4ead73471a9ff69b794d
version 0.0.10.0.1
-rw-r--r--LICENSE27
-rw-r--r--Setup.hs3
-rw-r--r--UtilityTM.cabal29
-rw-r--r--src/Control/Monad/TM.hs28
4 files changed, 87 insertions, 0 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..cc9e349
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,27 @@
+Copyright 2011 Tony Morris
+
+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 REGENTS 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 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.
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
index 0000000..200a2e5
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,3 @@
+import Distribution.Simple
+main = defaultMain
+
diff --git a/UtilityTM.cabal b/UtilityTM.cabal
new file mode 100644
index 0000000..c2b6eb4
--- /dev/null
+++ b/UtilityTM.cabal
@@ -0,0 +1,29 @@
+Name: UtilityTM
+Version: 0.0.1
+License: BSD3
+License-File: LICENSE
+Author: Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ>
+Maintainer: Tony Morris
+Synopsis: Utility functions that are missing from the standard library
+Category: Development
+Description: Utility functions that are missing from the standard library
+Homepage: https://bitbucket.org/dibblego/utility-tm/
+Cabal-version: >= 1.2
+Build-Type: Simple
+
+Flag small_base
+ Description: Choose the new, split-up base package.
+
+Library
+ Build-Depends:
+ base < 5 && >= 3
+
+ GHC-Options:
+ -Wall
+
+ Hs-Source-Dirs:
+ src
+
+ Exposed-Modules:
+ Control.Monad.TM
+
diff --git a/src/Control/Monad/TM.hs b/src/Control/Monad/TM.hs
new file mode 100644
index 0000000..9b17ecf
--- /dev/null
+++ b/src/Control/Monad/TM.hs
@@ -0,0 +1,28 @@
+-- | Monadic combinators missing from the standard library
+module Control.Monad.TM
+(
+ (.>>=.)
+, (.=<<.)
+) where
+
+import Data.Traversable
+import Control.Monad hiding (mapM)
+import Prelude hiding (mapM)
+
+-- | Lifting bind into a monad. Often denoted /concatMapM/.
+(.>>=.) ::
+ (Monad q, Monad m, Traversable m) =>
+ (a -> q (m b))
+ -> m a
+ -> q (m b)
+(.>>=.) f =
+ liftM join . mapM f
+
+-- | Lifting bind into a monad. Often denoted /concatMapM/.
+(.=<<.) ::
+ (Monad q, Monad m, Traversable m) =>
+ m a
+ -> (a -> q (m b))
+ -> q (m b)
+(.=<<.) =
+ flip (.>>=.)