monad-peel

This commit is contained in:
Michael Snoyman 2010-12-16 17:47:13 +02:00
parent 05fde1f464
commit 29c0fb7a2b
4 changed files with 11 additions and 29 deletions

View File

@ -13,7 +13,7 @@ module Yesod
, Application
, lift
, liftIO
, MonadInvertIO
, MonadPeelIO
, mempty
, showIntegral
, readIntegral
@ -41,7 +41,7 @@ import Yesod.Hamlet
import Control.Monad.Trans.Class (lift)
import Control.Monad.IO.Class (liftIO)
import Data.Monoid (mempty)
import Control.Monad.Invert (MonadInvertIO)
import Control.Monad.IO.Peel (MonadPeelIO)
showIntegral :: Integral a => a -> String
showIntegral x = show (fromIntegral x :: Integer)

View File

@ -112,8 +112,7 @@ import Control.Failure (Failure (failure))
import Text.Hamlet
import Control.Monad.Invert (MonadInvertIO (..))
import Control.Monad (liftM)
import Control.Monad.IO.Peel (MonadPeelIO)
import qualified Data.Map as Map
import qualified Data.ByteString.Char8 as S8
@ -210,7 +209,7 @@ newtype GHandler sub master a =
GHandler
{ unGHandler :: GHInner sub master a
}
deriving (Functor, Applicative, Monad, MonadIO)
deriving (Functor, Applicative, Monad, MonadIO, MonadPeelIO)
type GHInner s m =
ReaderT (HandlerData s m) (
@ -222,15 +221,6 @@ type GHInner s m =
type SessionMap = Map.Map String String
instance MonadInvertIO (GHandler s m) where
newtype InvertedIO (GHandler s m) a =
InvGHandlerIO
{ runInvGHandlerIO :: InvertedIO (GHInner s m) a
}
type InvertedArg (GHandler s m) = (HandlerData s m, (SessionMap, ()))
invertIO = liftM (fmap InvGHandlerIO) . invertIO . unGHandler
revertIO f = GHandler $ revertIO $ liftM runInvGHandlerIO . f
type Endo a = a -> a
-- | An extension of the basic WAI 'W.Application' datatype to provide extra

View File

@ -46,7 +46,7 @@ import Control.Monad.IO.Class (MonadIO)
import Control.Monad.Trans.Class (lift)
import Yesod.Internal
import Control.Monad.Invert (MonadInvertIO (..))
import Control.Monad.IO.Peel (MonadPeelIO)
import Control.Monad (liftM)
import qualified Data.Map as Map
@ -54,7 +54,7 @@ import qualified Data.Map as Map
-- site datatypes. This is basically a large 'WriterT' stack keeping track of
-- dependencies along with a 'StateT' to track unique identifiers.
newtype GWidget s m a = GWidget { unGWidget :: GWInner s m a }
deriving (Functor, Applicative, Monad, MonadIO)
deriving (Functor, Applicative, Monad, MonadIO, MonadPeelIO)
type GWInner sub master =
WriterT (Body (Route master)) (
WriterT (Last Title) (
@ -69,15 +69,6 @@ type GWInner sub master =
instance Monoid (GWidget sub master ()) where
mempty = return ()
mappend x y = x >> y
instance MonadInvertIO (GWidget s m) where
newtype InvertedIO (GWidget s m) a =
InvGWidgetIO
{ runInvGWidgetIO :: InvertedIO (GWInner s m) a
}
type InvertedArg (GWidget s m) =
(Int, (HandlerData s m, (Map.Map String String, ())))
invertIO = liftM (fmap InvGWidgetIO) . invertIO . unGWidget
revertIO f = GWidget $ revertIO $ liftM runInvGWidgetIO . f
instance HamletValue (GWidget s m ()) where
newtype HamletMonad (GWidget s m ()) a =

View File

@ -1,5 +1,5 @@
name: yesod
version: 0.6.8
version: 0.7.0
license: BSD3
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
@ -36,7 +36,7 @@ library
, text >= 0.5 && < 0.12
, template-haskell >= 2.4 && < 2.6
, web-routes-quasi >= 0.6.2 && < 0.7
, hamlet >= 0.5.1 && < 0.7
, hamlet >= 0.6 && < 0.7
, blaze-builder >= 0.2.1 && < 0.3
, transformers >= 0.2 && < 0.3
, clientsession >= 0.4.0 && < 0.5
@ -45,8 +45,8 @@ library
, cereal >= 0.2 && < 0.4
, base64-bytestring >= 0.1 && < 0.2
, old-locale >= 1.0.0.2 && < 1.1
, persistent >= 0.3.0 && < 0.4
, neither >= 0.1.0 && < 0.2
, persistent >= 0.4 && < 0.5
, neither >= 0.2 && < 0.3
, network >= 2.2.1.5 && < 2.4
, email-validate >= 0.2.5 && < 0.3
, web-routes >= 0.23 && < 0.24
@ -54,6 +54,7 @@ library
, data-default >= 0.2 && < 0.3
, failure >= 0.1 && < 0.2
, containers >= 0.2 && < 0.5
, monad-peel >= 0.1 && < 0.2
exposed-modules: Yesod
Yesod.Content
Yesod.Dispatch