git.iko.soy/typeable/postgresql-simple
on master help sign in
Implement the Monad of No Return proposal
commit3a639f2a4cff89523f930cc22239501a191ed887 authorLeon P Smith <leon@melding-monads.com> dateSat 19 Dec 2015, 05:30 (11 years ago) parent22074e5
2 files changed+9−4
src/Database/PostgreSQL/Simple/Internal.hs+4−2 src/Database/PostgreSQL/Simple/Ok.hs+5−2
src/Database/PostgreSQL/Simple/Internal.hs+4−2
@@ -4,7 +4,7 @@
44------------------------------------------------------------------------------
55-- |
66-- Module: Database.PostgreSQL.Simple.Internal
7−-- Copyright: (c) 2011-2012 Leon P Smith
7+-- Copyright: (c) 2011-2015 Leon P Smith
88-- License: BSD3
99-- Maintainer: Leon P Smith <leon@melding-monads.com>
1010-- Stability: experimental
@@ -476,7 +476,9 @@ instance Alternative Conversion where
476476 Errors _ -> (oka <|>) <$> runConversion mb conn
477477
478478instance Monad Conversion where
479− return a = Conversion $ \_conn -> return (return a)
479+#if !(MIN_VERSION_base(4,8,0))
480+ return = pure
481+#endif
480482 m >>= f = Conversion $ \conn -> do
481483 oka <- runConversion m conn
482484 case oka of
src/Database/PostgreSQL/Simple/Ok.hs+5−2
@@ -1,10 +1,11 @@
11{-# LANGUAGE DeriveDataTypeable #-}
22{-# LANGUAGE DeriveFunctor #-}
3+{-# LANGUAGE CPP #-}
34
45------------------------------------------------------------------------------
56-- |
67-- Module : Database.PostgreSQL.Simple.Ok
7−-- Copyright : (c) 2012 Leon P Smith
8+-- Copyright : (c) 2012-2015 Leon P Smith
89-- License : BSD3
910--
1011-- Maintainer : leon@melding-monads.com
@@ -69,7 +70,9 @@ instance MonadPlus Ok where
6970 mplus = (<|>)
7071
7172instance Monad Ok where
72− return = Ok
73+#if !(MIN_VERSION_base(4,8,0))
74+ return = pure
75+#endif
7376
7477 Errors es >>= _ = Errors es
7578 Ok a >>= f = f a