classy-prelude-yesod (empty) → 0.1.0.0
raw patch · 4 files changed
+107/−0 lines, 4 filesdep +basedep +classy-preludedep +classy-prelude-conduitsetup-changed
Dependencies added: base, classy-prelude, classy-prelude-conduit, http-conduit, http-types, persistent, yesod, yesod-newsfeed, yesod-static
Files
- ClassyPrelude/Yesod.hs +61/−0
- LICENSE +20/−0
- Setup.hs +2/−0
- classy-prelude-yesod.cabal +24/−0
+ ClassyPrelude/Yesod.hs view
@@ -0,0 +1,61 @@+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE TypeFamilies #-}+module ClassyPrelude.Yesod+ ( module X+ , module ClassyPrelude.Yesod+ ) where++import ClassyPrelude.Conduit as X hiding (lift)+import Yesod as X hiding (Request, Header, insert, delete)+import qualified Yesod+import Yesod.Static as X+import Yesod.Feed as X+import Network.HTTP.Conduit as X+import Network.HTTP.Types as X+import qualified ClassyPrelude.Classes+import Database.Persist.GenericSql.Raw as X (SqlBackend, SqlPersist)+import Database.Persist.GenericSql.Migration as X (runMigration)++instance+ ( backend ~ PersistMonadBackend m+ , backend ~ PersistEntityBackend entity+ , PersistStore m+ , PersistEntity entity+ , entity ~ entity'+ ) => ClassyPrelude.Classes.CanInsert (entity -> m (KeyBackend backend entity')) where+ insert = Yesod.insert++-- | Non-typeclass insert for use with Persistent.+--+-- If you don\'t use the @Key@ returned from @insert@, the type inferencing+-- cannot tell which @insert@ function to use. Using @insertDB@ disambiguates.+-- Another options is using 'voidKey'.+--+-- Since 0.1.0.0+insertDB :: ( PersistStore m+ , PersistEntity entity+ , PersistMonadBackend m ~ PersistEntityBackend entity+ )+ => entity+ -> m (Key entity)+insertDB = Yesod.insert++-- | Ignore the @Key@ returned by insert.+--+-- See 'insertDB' for more information. The following two lines are equivalent:+--+-- > _ <- insertDB foo+-- > voidKey $ insert foo+--+-- Since 0.1.0.0+voidKey :: Functor m => m (KeyBackend backend entity) -> m ()+voidKey = void++instance+ ( backend ~ PersistMonadBackend m+ , backend ~ PersistEntityBackend entity+ , PersistStore m+ , PersistEntity entity+ , a ~ ()+ ) => ClassyPrelude.Classes.CanDelete (KeyBackend backend entity -> m a) where+ delete = Yesod.delete
+ LICENSE view
@@ -0,0 +1,20 @@+Copyright (c) 2013 Michael Snoyman, http://www.yesodweb.com/++Permission is hereby granted, free of charge, to any person obtaining+a copy of this software and associated documentation files (the+"Software"), to deal in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject to+the following conditions:++The above copyright notice and this permission notice shall be+included in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ classy-prelude-yesod.cabal view
@@ -0,0 +1,24 @@+name: classy-prelude-yesod+version: 0.1.0.0+synopsis: Provide a classy prelude including common Yesod functionality.+description: This is an extension of classy-prelude-conduit, adding in commonly used functions and data types from Yesod.+homepage: https://github.com/snoyberg/classy-prelude+license: MIT+license-file: LICENSE+author: Michael Snoyman+maintainer: michael@snoyman.com+category: Control+build-type: Simple+cabal-version: >=1.8++library+ exposed-modules: ClassyPrelude.Yesod+ build-depends: base >= 4 && < 5+ , classy-prelude >= 0.4.3+ , classy-prelude-conduit >= 0.4.3+ , yesod+ , yesod-newsfeed+ , yesod-static+ , http-types+ , http-conduit+ , persistent >= 1.1