Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff --git a/Control/Monad/Trans/Class.hs b/Control/Monad/Trans/Class.hs
index b92bc0e..d6028dc 100644
--- a/Control/Monad/Trans/Class.hs
+++ b/Control/Monad/Trans/Class.hs
@@ -5,6 +5,7 @@
#if __GLASGOW_HASKELL__ >= 710
{-# LANGUAGE AutoDeriveTypeable #-}
#endif
+{-# LANGUAGE QuantifiedConstraints #-}
-----------------------------------------------------------------------------
-- |
-- Module : Control.Monad.Trans.Class
@@ -53,7 +54,7 @@ module Control.Monad.Trans.Class (
--
-- * @'lift' (m >>= f) = 'lift' m >>= ('lift' . f)@
-class MonadTrans t where
+class (forall m. Monad m => Monad (t m)) => MonadTrans t where
-- | Lift a computation from the argument monad to the constructed monad.
lift :: (Monad m) => m a -> t m a
diff --git a/Control/Monad/Trans/Error.hs b/Control/Monad/Trans/Error.hs
index 6eda4b3..6c6b1d2 100644
--- a/Control/Monad/Trans/Error.hs
+++ b/Control/Monad/Trans/Error.hs
@@ -260,7 +260,7 @@ instance (MonadFix m, Error e) => MonadFix (ErrorT e m) where
Right r -> r
_ -> error "empty mfix argument"
-instance MonadTrans (ErrorT e) where
+instance Error e => MonadTrans (ErrorT e) where
lift m = ErrorT $ do
a <- m
return (Right a)
adjunctions-4.4
aeson-1.5.4.0
aeson-compat-0.3.9
aeson-extra-0.4.1.3
aeson-optics-1.1.0.1
aeson-pretty-0.8.8
aeson-pretty-0.8.8 exe:aeson-pretty
ansi-terminal-0.11
ansi-wl-pprint-0.6.9
array-0.5.4.0
asn1-encoding-0.9.6
asn1-parse-0.9.5
asn1-types-0.3.4
assoc-1.0.2
async-2.2.2
attoparsec-0.13.2.4
attoparsec-iso8601-1.0.1.0
base16-bytestring-0.1.1.7
base-4.14.0.0
base64-bytestring-1.1.0.0
base64-bytestring-type-1.0.1
base-compat-0.11.1
base-compat-batteries-0.11.1
basement-0.0.11
base-orphans-0.8.2
bifunctors-5.5.7
bin-0.1
binary-0.8.8.0
binary-instances-1.0.0.1
binary-orphans-1.0.1
binary-tagged-0.3
blaze-builder-0.4.1.0
blaze-html-0.9.1.2
blaze-markup-0.8.2.7
boring-0.1.3
bound-2.0.1 lib:bound setup
bound-extras-0.0.2
bytes-0.17 lib:bytes setup
bytestring-0.10.10.0
bytestring-builder-0.10.8.2.0
Cabal-3.2.0.0
cabal-doctest-1.0.8
call-stack-0.2.0
carray-0.1.6.8
case-insensitive-1.2.1.0
cassava-0.5.2.0
cborg-0.2.4.0
cereal-0.5.8.1
charset-0.3.7.1
Chart-1.9.3
cmdargs-0.10.20
colour-2.3.5
commonmark-0.1.0.2
commonmark-extensions-0.2.0.1
commonmark-pandoc-0.2.0.1
comonad-5.0.6 lib:comonad setup
confusing-0.1
connection-0.3.1
constraints-0.11.2
containers-0.6.2.1
contravariant-1.5.2
cookie-0.4.5
cryptohash-sha512-0.11.100.1
cryptonite-0.27
crypt-sha512-0
data-default-0.7.1.1
data-default-class-0.1.2.0
data-default-instances-containers-0.0.1
data-default-instances-dlist-0.0.1
data-default-instances-old-locale-0.0.1
data-fix-0.3.0
dec-0.0.3
deepseq-1.4.4.0
digest-0.0.1.2
directory-1.3.6.0
distributive-0.6.2 lib:distributive setup
dlist-1.0
dlist-nonempty-0.1.1
doclayout-0.3
doctemplates-0.8.2
edit-distance-0.2.2.1
emojis-0.1
errors-2.3.0
exceptions-0.10.4
fft-0.1.8.6
file-embed-lzma-0
filepath-1.4.2.1
filtrable-0.1.6.0
fin-0.1.1
fingertree-0.1.4.2
free-5.1.3
functor-classes-compat-1
generics-sop-0.5.1.0
generics-sop-lens-0.2.0.1
ghc-boot-th-8.10.1
ghc-prim-0.6.1
Glob-0.10.1
haddock-library-1.9.0
half-0.3
hashable-1.3.0.0
hkd-0.1
hourglass-0.2.12
hsc2hs-0.68.7 exe:hsc2hs
hslua-1.1.2
hslua-module-system-0.2.2
hslua-module-text-0.2.1
HsYAML-0.2.1.0
HTTP-4000.3.15
http-api-data-0.4.2
http-client-0.7.2.1
http-client-tls-0.3.5.3
http-media-0.8.0.0
http-types-0.12.3
hxt-9.3.1.18
hxt-charproperties-9.4.0.0
hxt-regex-xmlschema-9.2.0.3
hxt-unicode-9.0.2.4
indexed-profunctors-0.1
insert-ordered-containers-0.2.3.1
integer-gmp-1.0.3.0
integer-logarithms-1.0.3
intervals-0.9.1 lib:intervals setup
invariant-0.5.3
ipynb-0.1.0.1
ix-shapable-0.1.0
jira-wiki-markup-1.3.2
jira-wiki-markup-1.3.2 exe:jira-wiki-markup
JuicyPixels-3.3.5
JuicyPixels-scale-dct-0.1.2
kan-extensions-5.2
kleene-0.1
lattices-2.0.2
lens-4.19.2 lib:lens setup
lucid-2.9.12
lukko-0.1.1.2
lzma-0.0.0.3
memory-0.15.0
MemoTrie-0.6.10
microstache-1.0.1.1
mime-types-0.1.0.9
mmorph-1.1.3
monad-chronicle-1.0.0.1
months-0.1
mtl-2.2.2
network-3.1.2.0
network-uri-2.6.3.0
newtype-generics-0.5.4
old-locale-1.0.0.7
old-time-1.1.0.3
OneTuple-0.2.2.1
Only-0.1
operational-0.2.3.5
operational-0.2.3.5 exe:operational-TicTacToe
optics-core-0.3.0.1
optics-extra-0.3
optics-th-0.3.0.2
pandoc-2.10.1
pandoc-2.10.1 exe:pandoc
pandoc-types-1.21
parallel-3.2.2.0
parsec-3.1.14.0
parsers-0.12.10
pem-0.2.4
postgresql-libpq-0.9.4.2 lib:postgresql-libpq setup
postgresql-simple-0.6.2
postgresql-simple-url-0.2.1.0
pretty-1.1.3.6
primitive-0.7.1.0
process-1.6.8.2
profunctors-5.4
QuickCheck-2.14.1
quickcheck-instances-0.3.24
ral-0.1.1
ral-lens-0.1
ral-optics-0.1
random-1.1
range-set-list-0.1.3.1
recursion-schemes-5.2
reducers-3.12.3
reflection-2.1.6
regex-applicative-0.3.4
regex-applicative-text-0.1.0.1
regex-base-0.94.0.0
regex-pcre-builtin-0.95.1.2.8.43
rere-0.1
rts-1.0
safe-0.3.19
scientific-0.3.6.2
semialign-1.1.0.1
semialign-indexed-1.1
semialign-optics-1.1
semigroupoids-5.3.4 lib:semigroupoids setup
semigroups-0.19.1
serialise-0.2.3.0
SHA-1.6.4.4
singleton-bool-0.1.5
skylighting-0.8.5
skylighting-core-0.8.5
socks-0.6.1
some-1.0.1
sop-core-0.5.0.1
spdx-1.0.0.2
split-0.2.3.4
splitmix-0.1.0.1
StateVar-1.2
step-function-0.2
stm-2.5.0.0
storable-complex-0.2.3.0
streaming-commons-0.2.2.1
streams-3.3
strict-0.4
structured-0.1
swagger2-2.6 lib:swagger2 setup
syb-0.7.1
tagged-0.8.6
tagsoup-0.14.8
tdigest-0.2.1 lib:tdigest setup
tdigest-Chart-0.2
template-haskell-2.16.0.0
temporary-1.3
texmath-0.12.0.3
text-1.2.3.2
text-binary-0.2.1.1
text-conversions-0.3.0
text-short-0.1.3
th-abstraction-0.3.2.0
these-1.1.1.1
these-lens-1.0.0.1
these-optics-1
th-lift-0.8.1
th-lift-instances-0.1.17
time-1.9.3
time-compat-1.9.3
time-locale-compat-0.1.1.5
time-parsers-0.1.2.1
tls-1.5.4
topograph-1.0.0.1
transformers-0.5.6.2
transformers-base-0.4.5.2
transformers-compat-0.6.5
tree-diff-0.1
type-equality-1
unicode-transforms-0.3.7
universe-base-1.1.1
universe-reverse-instances-1.1
unix-2.7.2.2
unordered-containers-0.2.12.0
utf8-string-1.0.1.1
uuid-types-1.0.3
vec-0.3.0.1
vec-lens-0.3
vec-optics-0.3
vector-0.12.1.2
vector-algorithms-0.8.0.3
vector-binary-instances-0.2.5.1
void-0.7.3
x509-1.7.5
x509-store-1.6.7
x509-system-1.6.6
x509-validation-1.6.11
xml-1.3.14
zinza-0.2
zip-archive-0.4.1
zlib-0.6.2.2
diff --git a/src/Control/Monad/Trans/Free.hs b/src/Control/Monad/Trans/Free.hs
index 15014ea..522e878 100644
--- a/src/Control/Monad/Trans/Free.hs
+++ b/src/Control/Monad/Trans/Free.hs
@@ -315,7 +315,7 @@ instance (Functor f, Monad m) => Monad (FreeT f m) where
instance (Functor f, Fail.MonadFail m) => Fail.MonadFail (FreeT f m) where
fail e = FreeT (Fail.fail e)
-instance MonadTrans (FreeT f) where
+instance (Functor f) => MonadTrans (FreeT f) where
lift = FreeT . liftM Pure
{-# INLINE lift #-}
diff --git a/src/Control/Monad/Trans/Free/Ap.hs b/src/Control/Monad/Trans/Free/Ap.hs
index ed42b0f..a859e56 100644
--- a/src/Control/Monad/Trans/Free/Ap.hs
+++ b/src/Control/Monad/Trans/Free/Ap.hs
@@ -314,7 +314,7 @@ instance (Applicative f, Applicative m, Monad m) => Monad (FreeT f m) where
instance (Applicative f, Applicative m, Fail.MonadFail m) => Fail.MonadFail (FreeT f m) where
fail e = FreeT (Fail.fail e)
-instance MonadTrans (FreeT f) where
+instance (Applicative f) => MonadTrans (FreeT f) where
lift = FreeT . liftM Pure
{-# INLINE lift #-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment