Safe Haskell | None |
---|---|
Language | Haskell2010 |
- (@/=) :: (Eq a, Show a, MonadIO m) => a -> a -> m ()
- (@==) :: (Eq a, Show a, MonadIO m) => a -> a -> m ()
- (==@) :: (Eq a, Show a, MonadIO m) => a -> a -> m ()
- assertNotEqual :: (Eq a, Show a) => String -> a -> a -> Assertion
- assertNotEmpty :: (Monad m, MonadIO m) => [a] -> m ()
- assertEmpty :: (Monad m, MonadIO m) => [a] -> m ()
- isTravis :: IO Bool
- type BackendMonad = SqlBackend
- runConn :: MonadUnliftIO m => SqlPersistT (LoggingT m) t -> m ()
- class Monad m => MonadIO (m :: * -> *) where
- persistSettings :: MkPersistSettings
- data MkPersistSettings :: *
- db :: SqlPersistT (LoggingT (ResourceT IO)) () -> Assertion
- sqlite_database :: SqliteConnectionInfo
- sqlite_database_file :: Text
- data family BackendKey backend :: *
- generateKey :: IO (BackendKey SqlBackend)
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- (<*>) :: Applicative f => forall a b. f (a -> b) -> f a -> f b
- module Database.Persist
- module Test.Hspec
- module Test.HUnit
- liftIO :: MonadIO m => forall a. IO a -> m a
- mkPersist :: MkPersistSettings -> [EntityDef] -> Q [Dec]
- mkMigrate :: String -> [EntityDef] -> Q [Dec]
- share :: [[EntityDef] -> Q [Dec]] -> [EntityDef] -> Q [Dec]
- sqlSettings :: MkPersistSettings
- persistLowerCase :: QuasiQuoter
- persistUpperCase :: QuasiQuoter
- data Int32 :: *
- data Int64 :: *
- data Text :: *
- module Control.Monad.Trans.Reader
- module Control.Monad
- module Database.Persist.Sql
- data ByteString :: *
- data SomeException :: *
Documentation
assertNotEmpty :: (Monad m, MonadIO m) => [a] -> m () Source #
assertEmpty :: (Monad m, MonadIO m) => [a] -> m () Source #
type BackendMonad = SqlBackend Source #
runConn :: MonadUnliftIO m => SqlPersistT (LoggingT m) t -> m () Source #
class Monad m => MonadIO (m :: * -> *) where #
Monads in which IO
computations may be embedded.
Any monad built by applying a sequence of monad transformers to the
IO
monad will be an instance of this class.
Instances should satisfy the following laws, which state that liftIO
is a transformer of monads:
MonadIO IO | Since: 4.9.0.0 |
MonadIO m => MonadIO (ResourceT m) | |
MonadIO m => MonadIO (NoLoggingT m) | |
MonadIO m => MonadIO (WriterLoggingT m) | |
MonadIO m => MonadIO (LoggingT m) | |
(Monoid w, MonadIO m) => MonadIO (WriterT w m) | |
(Error e, MonadIO m) => MonadIO (ErrorT e m) | |
MonadIO m => MonadIO (IdentityT * m) | |
MonadIO m => MonadIO (ReaderT * r m) | |
MonadIO m => MonadIO (ConduitT i o m) | |
MonadIO m => MonadIO (Pipe l i o u m) | |
data MkPersistSettings :: * #
Settings to be passed to the mkPersist
function.
data family BackendKey backend :: * #
data BackendKey SqlBackend | |
data BackendKey SqlReadBackend | |
data BackendKey SqlWriteBackend | |
generateKey :: IO (BackendKey SqlBackend) Source #
(<$>) :: Functor f => (a -> b) -> f a -> f b infixl 4 #
An infix synonym for fmap
.
The name of this operator is an allusion to $
.
Note the similarities between their types:
($) :: (a -> b) -> a -> b (<$>) :: Functor f => (a -> b) -> f a -> f b
Whereas $
is function application, <$>
is function
application lifted over a Functor
.
Examples
Convert from a
to a Maybe
Int
using Maybe
String
show
:
>>>
show <$> Nothing
Nothing>>>
show <$> Just 3
Just "3"
Convert from an
to an Either
Int
Int
Either
Int
String
using show
:
>>>
show <$> Left 17
Left 17>>>
show <$> Right 17
Right "17"
Double each element of a list:
>>>
(*2) <$> [1,2,3]
[2,4,6]
Apply even
to the second element of a pair:
>>>
even <$> (2,2)
(2,True)
(<*>) :: Applicative f => forall a b. f (a -> b) -> f a -> f b infixl 4 #
Sequential application.
A few functors support an implementation of <*>
that is more
efficient than the default one.
module Database.Persist
module Test.Hspec
module Test.HUnit
mkPersist :: MkPersistSettings -> [EntityDef] -> Q [Dec] #
Create data types and appropriate PersistEntity
instances for the given
EntityDef
s. Works well with the persist quasi-quoter.
mkMigrate :: String -> [EntityDef] -> Q [Dec] #
Creates a single function to perform all migrations for the entities defined here. One thing to be aware of is dependencies: if you have entities with foreign references, make sure to place those definitions after the entities they reference.
share :: [[EntityDef] -> Q [Dec]] -> [EntityDef] -> Q [Dec] #
Apply the given list of functions to the same EntityDef
s.
This function is useful for cases such as:
>>>
share [mkSave "myDefs", mkPersist sqlSettings] [persistLowerCase|...|]
sqlSettings :: MkPersistSettings #
Use the SqlPersist
backend.
persistLowerCase :: QuasiQuoter #
Apply persistWith
to lowerCaseSettings
.
persistUpperCase :: QuasiQuoter #
Apply persistWith
to upperCaseSettings
.
32-bit signed integer type
Bounded Int32 | Since: 2.1 |
Enum Int32 | Since: 2.1 |
Eq Int32 | Since: 2.1 |
Integral Int32 | Since: 2.1 |
Num Int32 | Since: 2.1 |
Ord Int32 | Since: 2.1 |
Read Int32 | Since: 2.1 |
Real Int32 | Since: 2.1 |
Show Int32 | Since: 2.1 |
Ix Int32 | Since: 2.1 |
Lift Int32 | |
Arbitrary Int32 | |
CoArbitrary Int32 | |
Hashable Int32 | |
ToJSON Int32 | |
ToJSONKey Int32 | |
FromJSON Int32 | |
FromJSONKey Int32 | |
Storable Int32 | Since: 2.1 |
Bits Int32 | Since: 2.1 |
FiniteBits Int32 | Since: 4.6.0.0 |
ToValue Int32 | |
ToMarkup Int32 | |
ToHttpApiData Int32 | |
FromHttpApiData Int32 | |
PathPiece Int32 | |
PersistFieldSql Int32 | |
PersistField Int32 | |
Prim Int32 | |
Random Int32 | |
Unbox Int32 | |
Vector Vector Int32 | |
MVector MVector Int32 | |
data Vector Int32 | |
data MVector s Int32 | |
64-bit signed integer type
Bounded Int64 | Since: 2.1 |
Enum Int64 | Since: 2.1 |
Eq Int64 | Since: 2.1 |
Integral Int64 | Since: 2.1 |
Num Int64 | Since: 2.1 |
Ord Int64 | Since: 2.1 |
Read Int64 | Since: 2.1 |
Real Int64 | Since: 2.1 |
Show Int64 | Since: 2.1 |
Ix Int64 | Since: 2.1 |
Lift Int64 | |
Arbitrary Int64 | |
CoArbitrary Int64 | |
Hashable Int64 | |
ToJSON Int64 | |
ToJSONKey Int64 | |
FromJSON Int64 | |
FromJSONKey Int64 | |
Storable Int64 | Since: 2.1 |
Bits Int64 | Since: 2.1 |
FiniteBits Int64 | Since: 4.6.0.0 |
ToValue Int64 | |
ToMarkup Int64 | |
ToHttpApiData Int64 | |
FromHttpApiData Int64 | |
PathPiece Int64 | |
PersistFieldSql Int64 | |
PersistField Int64 | |
Prim Int64 | |
Random Int64 | |
Unbox Int64 | |
Vector Vector Int64 | |
MVector MVector Int64 | |
data Vector Int64 | |
data MVector s Int64 | |
A space efficient, packed, unboxed Unicode text type.
Hashable Text | |
ToJSON Text | |
KeyValue Pair | |
ToJSONKey Text | |
FromJSON Text | |
FromJSONKey Text | |
Chunk Text | |
ToValue Text | |
ToMarkup Text | |
ToLogStr Text | |
ToHttpApiData Text | |
FromHttpApiData Text | |
PathPiece Text | |
PersistFieldSql Text | |
PersistField Text | |
Lift' Text | |
FromPairs Value (DList Pair) | |
ToJSON v => GKeyValue v (DList Pair) | |
PersistFieldSql v => PersistFieldSql (Map Text v) | |
PersistField v => PersistField (Map Text v) | |
type State Text | |
type ChunkElem Text | |
type Item Text | |
module Control.Monad.Trans.Reader
module Control.Monad
module Database.Persist.Sql
data ByteString :: * #
A space-efficient representation of a Word8
vector, supporting many
efficient operations.
A ByteString
contains 8-bit bytes, or by using the operations from
Data.ByteString.Char8 it can be interpreted as containing 8-bit
characters.
data SomeException :: * #
The SomeException
type is the root of the exception type hierarchy.
When an exception of type e
is thrown, behind the scenes it is
encapsulated in a SomeException
.
Show SomeException | Since: 3.0 |
Exception SomeException | Since: 3.0 |
Orphan instances
Arbitrary PersistValue Source # | |
PersistStore backend => Arbitrary (BackendKey backend) Source # | |