summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConalElliott <>2013-01-17 01:27:36 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2013-01-17 01:27:36 (GMT)
commitef45e3422802e2cddccf05176f891b37e886cbd7 (patch)
tree5a042189dffb6f11a60d08f5c521ddb4e7f3fc21
parentc8f2dbe5f6c7919bd7f740a92dc70350026364c0 (diff)
version 0.9.80.9.8
-rw-r--r--TypeCompose.cabal4
-rw-r--r--src/Control/Compose.hs27
-rw-r--r--src/Data/Partial.hs1
3 files changed, 16 insertions, 16 deletions
diff --git a/TypeCompose.cabal b/TypeCompose.cabal
index 042c958..c6693ad 100644
--- a/TypeCompose.cabal
+++ b/TypeCompose.cabal
@@ -1,5 +1,5 @@
Name: TypeCompose
-Version: 0.9.7
+Version: 0.9.8
Synopsis: Type composition classes & instances
Category: Composition, Control
Cabal-Version: >= 1.6
@@ -13,7 +13,7 @@ Description:
Author: Conal Elliott
Maintainer: conal@conal.net
Homepage: https://github.com/conal/TypeCompose
-Copyright: (c) 2007-2012 by Conal Elliott
+Copyright: (c) 2007-2013 by Conal Elliott
License: BSD3
License-File: COPYING
Stability: provisional
diff --git a/src/Control/Compose.hs b/src/Control/Compose.hs
index fcfc5ba..828da48 100644
--- a/src/Control/Compose.hs
+++ b/src/Control/Compose.hs
@@ -11,7 +11,7 @@
----------------------------------------------------------------------
-- |
-- Module : Control.Compose
--- Copyright : (c) Conal Elliott 2007-2012
+-- Copyright : (c) Conal Elliott 2007-2013
-- License : BSD3
--
-- Maintainer : conal@conal.net
@@ -36,7 +36,7 @@ module Control.Compose
, (:.)(..), O, unO, biO, convO, coconvO, inO, inO2, inO3
, oPure, oFmap, oLiftA2, oLiftA3
, fmapFF, fmapCC, contraFmapFC, contraFmapCF
- -- , DistribM(..), joinMM
+ , DistribM(..), joinDistribM
, joinMMT, joinComposeT
-- * Type composition
-- ** Unary\/binary
@@ -80,7 +80,7 @@ import Data.Monoid
import Data.Foldable
import Data.Traversable
import Control.Applicative
-import Control.Monad (join)
+import Control.Monad (join,liftM)
-- import Test.QuickCheck -- for Endo
@@ -354,8 +354,6 @@ instance (Applicative g, Applicative f) => Applicative (g :. f) where
-{-
-
-- A first pass at monad composition. But now I've read "Composing
-- Monads", and I know there's more to it. At least four different ways,
-- all with conflicting Monad instances.
@@ -366,26 +364,27 @@ instance (Applicative g, Applicative f) => Applicative (g :. f) where
class DistribM m n where
distribM :: n (m a) -> m (n a)
-instance (Monad m, Monad n, DistribM m n) => Monad (m :. n) where
- return = O . return . return
- e >>= f = joinMM (liftM f e)
-
-- | 'join' for @(m :. n)@
-joinMM :: (Monad m, Monad n, DistribM m n) =>
- (m :. n) ((m :. n) a) -> (m :. n) a
-joinMM = O . liftM join . join . liftM distribM . unO . liftM unO
+joinDistribM :: (Monad m, Monad n, DistribM m n) =>
+ (m :. n) ((m :. n) a) -> (m :. n) a
+joinDistribM = O . liftM join . join . liftM distribM . (liftM.liftM) unO . unO
-- Derivation:
--
-- (m :. n) ((m :. n) a)
--- --> m (n (m (n a))) -- liftM unO
-- --> m (n ((m :. n) a)) -- unO
+-- --> m (n (m (n a))) -- (liftM.liftM) unO
-- --> m (m (n (n a))) -- liftM distribM
-- --> m (n (n a)) -- join
-- --> m (n a) -- liftM join
-- --> (m :. n) a -- O
--}
+-- Template for specialization:
+--
+-- instance (Monad m, Monad n, DistribM m n) => Monad (m :. n) where
+-- return = O . return . return
+-- e >>= f = joinDistribM (liftM f e)
+
-- | 'join'-like function for implicitly composed monads
joinMMT :: (Monad m, Monad n, Traversable n, Applicative m) =>
diff --git a/src/Data/Partial.hs b/src/Data/Partial.hs
index e253ca8..4eded6c 100644
--- a/src/Data/Partial.hs
+++ b/src/Data/Partial.hs
@@ -1,5 +1,6 @@
{-# LANGUAGE TypeSynonymInstances #-}
{-# OPTIONS_GHC -Wall #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
----------------------------------------------------------------------
-- |
-- Module : Data.Partial