Removed persistent dependency
This commit is contained in:
parent
d723e40542
commit
cb9f798ff9
@ -27,10 +27,10 @@ module Yesod.Dispatch
|
|||||||
) where
|
) where
|
||||||
|
|
||||||
#if TEST
|
#if TEST
|
||||||
import Yesod.Yesod hiding (testSuite, Key)
|
import Yesod.Yesod hiding (testSuite)
|
||||||
import Yesod.Handler hiding (testSuite)
|
import Yesod.Handler hiding (testSuite)
|
||||||
#else
|
#else
|
||||||
import Yesod.Yesod hiding (Key)
|
import Yesod.Yesod
|
||||||
import Yesod.Handler
|
import Yesod.Handler
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -11,11 +11,6 @@ module Yesod.Yesod
|
|||||||
Yesod (..)
|
Yesod (..)
|
||||||
, YesodSite (..)
|
, YesodSite (..)
|
||||||
, YesodSubSite (..)
|
, YesodSubSite (..)
|
||||||
-- ** Persistence
|
|
||||||
, YesodPersist (..)
|
|
||||||
, module Database.Persist
|
|
||||||
, get404
|
|
||||||
, getBy404
|
|
||||||
-- ** Breadcrumbs
|
-- ** Breadcrumbs
|
||||||
, YesodBreadcrumbs (..)
|
, YesodBreadcrumbs (..)
|
||||||
, breadcrumbs
|
, breadcrumbs
|
||||||
@ -51,9 +46,6 @@ import qualified Network.Wai as W
|
|||||||
import Yesod.Internal
|
import Yesod.Internal
|
||||||
import Web.ClientSession (getKey, defaultKeyFile)
|
import Web.ClientSession (getKey, defaultKeyFile)
|
||||||
import qualified Web.ClientSession as CS
|
import qualified Web.ClientSession as CS
|
||||||
import Database.Persist
|
|
||||||
import Control.Monad.Trans.Class (MonadTrans (..))
|
|
||||||
import Control.Failure (Failure)
|
|
||||||
import qualified Data.ByteString as S
|
import qualified Data.ByteString as S
|
||||||
import qualified Data.ByteString.Char8 as S8
|
import qualified Data.ByteString.Char8 as S8
|
||||||
import qualified Data.ByteString.Lazy as L
|
import qualified Data.ByteString.Lazy as L
|
||||||
@ -378,30 +370,6 @@ defaultErrorHandler (BadMethod m) =
|
|||||||
%p Method "$m$" not supported
|
%p Method "$m$" not supported
|
||||||
|]
|
|]
|
||||||
|
|
||||||
class YesodPersist y where
|
|
||||||
type YesodDB y :: (* -> *) -> * -> *
|
|
||||||
runDB :: YesodDB y (GHandler sub y) a -> GHandler sub y a
|
|
||||||
|
|
||||||
|
|
||||||
-- Get the given entity by ID, or return a 404 not found if it doesn't exist.
|
|
||||||
get404 :: (PersistBackend (t m), PersistEntity val, Monad (t m),
|
|
||||||
Failure ErrorResponse m, MonadTrans t)
|
|
||||||
=> Key val -> t m val
|
|
||||||
get404 key = do
|
|
||||||
mres <- get key
|
|
||||||
case mres of
|
|
||||||
Nothing -> lift notFound
|
|
||||||
Just res -> return res
|
|
||||||
|
|
||||||
getBy404 :: (PersistBackend (t m), PersistEntity val, Monad (t m),
|
|
||||||
Failure ErrorResponse m, MonadTrans t)
|
|
||||||
=> Unique val -> t m (Key val, val)
|
|
||||||
getBy404 ukey = do
|
|
||||||
mres <- getBy ukey
|
|
||||||
case mres of
|
|
||||||
Nothing -> lift notFound
|
|
||||||
Just res -> return res
|
|
||||||
|
|
||||||
-- | Return the same URL if the user is authorized to see it.
|
-- | Return the same URL if the user is authorized to see it.
|
||||||
--
|
--
|
||||||
-- Built on top of 'isAuthorized'. This is useful for building page that only
|
-- Built on top of 'isAuthorized'. This is useful for building page that only
|
||||||
|
|||||||
@ -34,7 +34,7 @@ library
|
|||||||
, bytestring >= 0.9.1.4 && < 0.10
|
, bytestring >= 0.9.1.4 && < 0.10
|
||||||
, directory >= 1 && < 1.2
|
, directory >= 1 && < 1.2
|
||||||
, text >= 0.5 && < 0.12
|
, text >= 0.5 && < 0.12
|
||||||
, template-haskell >= 2.4 && < 2.6
|
, template-haskell
|
||||||
, web-routes-quasi >= 0.6.2 && < 0.7
|
, web-routes-quasi >= 0.6.2 && < 0.7
|
||||||
, hamlet >= 0.6 && < 0.7
|
, hamlet >= 0.6 && < 0.7
|
||||||
, blaze-builder >= 0.2.1 && < 0.3
|
, blaze-builder >= 0.2.1 && < 0.3
|
||||||
@ -45,7 +45,6 @@ library
|
|||||||
, cereal >= 0.2 && < 0.4
|
, cereal >= 0.2 && < 0.4
|
||||||
, base64-bytestring >= 0.1 && < 0.2
|
, base64-bytestring >= 0.1 && < 0.2
|
||||||
, old-locale >= 1.0.0.2 && < 1.1
|
, old-locale >= 1.0.0.2 && < 1.1
|
||||||
, persistent >= 0.4 && < 0.5
|
|
||||||
, neither >= 0.2 && < 0.3
|
, neither >= 0.2 && < 0.3
|
||||||
, network >= 2.2.1.5 && < 2.4
|
, network >= 2.2.1.5 && < 2.4
|
||||||
, email-validate >= 0.2.5 && < 0.3
|
, email-validate >= 0.2.5 && < 0.3
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user