Safe Haskell | None |
---|
This module implements the laws in Control.Monad, specified in the Haskell 2010 report, in 6.3.5 for Functor, in 6.3.6 for Monad, and in Chapter 13, module Control.Monad.
- module Test.ClassLaws
- data FunctorLaw1 a f
- data FunctorLaw2 a b c f
- class Functor f => FunctorLaws f where
- functorLaw1 :: Law (FunctorLaw1 a f)
- functorLaw2 :: Law (FunctorLaw2 a b c f)
- defaultFunctorLaw1 :: Functor f => f b -> Theorem (f b)
- defaultFunctorLaw2 :: Functor f => (b1 -> b, a -> b1, f a) -> Theorem (f b)
- data MonadLaw1 a b m
- data MonadLaw2 b m
- data MonadLaw3 b c d m
- class Monad m => MonadLaws m where
- defaultMonadLaw1 :: Monad m => (a, a -> m b) -> Theorem (m b)
- defaultMonadLaw2 :: Monad m => m b -> Theorem (m b)
- defaultMonadLaw3 :: Monad m => (m a1, a1 -> m a, a -> m b) -> Theorem (m b)
- data FunctorMonadLaw a b m
- class (Functor m, Monad m) => FunctorMonadLaws m where
- functorMonadLaw :: Law (FunctorMonadLaw a b m)
- defaultFunctorMonadLaw :: (Monad f, Functor f) => (a -> b, f a) -> Theorem (f b)
- data MonadPlusLaw1 a m
- data MonadPlusLaw2 a m
- data MonadPlusLaw3 a b m
- data MonadPlusLaw4 a m
- data MonadPlusLaw5 a m
- class MonadPlus m => MonadPlusLaws m where
- monadPlusLaw1 :: Law (MonadPlusLaw1 a m)
- monadPlusLaw2 :: Law (MonadPlusLaw2 a m)
- monadPlusLaw3 :: Law (MonadPlusLaw3 a b m)
- monadPlusLaw4 :: Law (MonadPlusLaw4 a m)
- monadPlusLaw5 :: Law (MonadPlusLaw5 a m)
- defaultMonadPlusLaw1 :: MonadPlus m => m a -> Theorem (m a)
- defaultMonadPlusLaw2 :: MonadPlus m => m a -> Theorem (m a)
- defaultMonadPlusLaw3 :: MonadPlus m => (a -> m b) -> Theorem (m b)
- defaultMonadPlusLaw4 :: MonadPlus m => m a -> Theorem (m b)
- defaultMonadPlusLaw5 :: MonadPlus m => (m a, m a, m a) -> Theorem (m a)
Documentation
module Test.ClassLaws
data FunctorLaw1 a f Source
(FunctorLaws f, TestEqual (f a)) => LawTest (FunctorLaw1 a f) |
data FunctorLaw2 a b c f Source
(FunctorLaws f, TestEqual (f c)) => LawTest (FunctorLaw2 a b c f) |
class Functor f => FunctorLaws f whereSource
functorLaw1 :: Law (FunctorLaw1 a f)Source
functorLaw2 :: Law (FunctorLaw2 a b c f)Source
FunctorLaws [] | |
FunctorLaws IO | |
FunctorLaws Maybe | |
FunctorLaws MyList | |
Functor (SS s) => FunctorLaws (SS s) | |
Functor (State s) => FunctorLaws (State s) |
defaultFunctorLaw1 :: Functor f => f b -> Theorem (f b)Source
defaultFunctorLaw2 :: Functor f => (b1 -> b, a -> b1, f a) -> Theorem (f b)Source
defaultMonadLaw1 :: Monad m => (a, a -> m b) -> Theorem (m b)Source
defaultMonadLaw2 :: Monad m => m b -> Theorem (m b)Source
defaultMonadLaw3 :: Monad m => (m a1, a1 -> m a, a -> m b) -> Theorem (m b)Source
data FunctorMonadLaw a b m Source
(FunctorMonadLaws m, TestEqual (m b)) => LawTest (FunctorMonadLaw a b m) |
class (Functor m, Monad m) => FunctorMonadLaws m whereSource
functorMonadLaw :: Law (FunctorMonadLaw a b m)Source
FunctorMonadLaws [] | |
FunctorMonadLaws IO | |
FunctorMonadLaws Maybe | |
FunctorMonadLaws MyList | |
(Functor (SS s), Monad (SS s)) => FunctorMonadLaws (SS s) | |
(Functor (State s), Monad (State s)) => FunctorMonadLaws (State s) |
defaultFunctorMonadLaw :: (Monad f, Functor f) => (a -> b, f a) -> Theorem (f b)Source
data MonadPlusLaw1 a m Source
The laws for MonadPlus are less prominently declared in the base libraries.
(MonadPlusLaws m, TestEqual (m a)) => LawTest (MonadPlusLaw1 a m) |
data MonadPlusLaw2 a m Source
(MonadPlusLaws m, TestEqual (m a)) => LawTest (MonadPlusLaw2 a m) |
data MonadPlusLaw3 a b m Source
(MonadPlusLaws m, TestEqual (m b)) => LawTest (MonadPlusLaw3 a b m) |
data MonadPlusLaw4 a m Source
(MonadPlusLaws m, TestEqual (m a)) => LawTest (MonadPlusLaw4 a m) |
data MonadPlusLaw5 a m Source
(MonadPlusLaws m, TestEqual (m a)) => LawTest (MonadPlusLaw5 a m) |
class MonadPlus m => MonadPlusLaws m whereSource
monadPlusLaw1 :: Law (MonadPlusLaw1 a m)Source
monadPlusLaw2 :: Law (MonadPlusLaw2 a m)Source
monadPlusLaw3 :: Law (MonadPlusLaw3 a b m)Source
monadPlusLaw4 :: Law (MonadPlusLaw4 a m)Source
monadPlusLaw5 :: Law (MonadPlusLaw5 a m)Source
defaultMonadPlusLaw1 :: MonadPlus m => m a -> Theorem (m a)Source
defaultMonadPlusLaw2 :: MonadPlus m => m a -> Theorem (m a)Source
defaultMonadPlusLaw3 :: MonadPlus m => (a -> m b) -> Theorem (m b)Source
defaultMonadPlusLaw4 :: MonadPlus m => m a -> Theorem (m b)Source
defaultMonadPlusLaw5 :: MonadPlus m => (m a, m a, m a) -> Theorem (m a)Source