Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Profunctor.Product.Examples
Synopsis
- newtype Replicator r f a b = Replicator (r -> f b)
- replicateT :: Default (Replicator r f) b b => r -> f b
- newtype Take a z b = Take ([a] -> Maybe ([a], b))
- takeT :: Default (Take a) b b => [a] -> Maybe b
- newtype Traverse f a b = Traverse {
- runTraverse :: a -> f b
- traverseT :: Default (Traverse f) a b => a -> f b
- type Sequence = Traverse
- sequenceT :: Default (Sequence f) a b => a -> f b
- newtype Zipper a b = Zipper {}
- cl_map :: Default Zipper a b => (b -> r) -> a -> [r]
Documentation
newtype Replicator r f a b Source #
Constructors
Replicator (r -> f b) |
Instances
replicateT :: Default (Replicator r f) b b => r -> f b Source #
A higher-order generalisation of replicate
. For
example
foo :: IO (String, String, String) foo = replicateT getLine
> foo Hello world ! ("Hello","world","!")
Instances
Profunctor (Take a) Source # | |
Defined in Data.Profunctor.Product.Examples | |
ProductProfunctor (Take a) Source # | |
Default (Take a) z a Source # | |
Defined in Data.Profunctor.Product.Examples | |
Functor (Take a z) Source # | |
Applicative (Take a z) Source # | |
Defined in Data.Profunctor.Product.Examples |
takeT :: Default (Take a) b b => [a] -> Maybe b Source #
A type safe generalisation of take
. For example
> let count = [1..] :: [Int] > takeT count :: Maybe (Int, Int) Just (1,2) > takeT count :: Maybe (Int, Int, (Int, (Int, Int), Int, Int), Const Int Bool, Identity (Int, Int), Tagged String Int) Just (1,2,(3,(4,5),6,7),Const 8,Identity (9,10),Tagged 11)
newtype Traverse f a b Source #
Constructors
Traverse | |
Fields
|
Instances
traverseT :: Default (Traverse f) a b => a -> f b Source #
Use sequenceT
instead. It has a better name.
Instances
Profunctor Zipper Source # | |
Defined in Data.Profunctor.Product.Examples | |
ProductProfunctor Zipper Source # | |
a ~ b => Default Zipper [a] b Source # | |
Defined in Data.Profunctor.Product.Examples | |
Functor (Zipper a) Source # | |
Applicative (Zipper a) Source # | |
Defined in Data.Profunctor.Product.Examples |