| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
FStrong
Documentation
class FFunctor ff => FStrong ff where Source #
Minimal complete definition
Methods
fstrength :: Functor g => Day (ff g) h ~> ff (Day g h) Source #
Tensorial strength with respect to Day.
fstrength can be thought as a higher-order version of strength function below.
strength :: Functor f => (f a, b) -> f (a, b) strength (fa, b) = fmap (a -> (a,b)) fa
For the ordinary Functor, no additional type classes were needed to have strength function,
because it works for any Functor f. This is not the case for FFunctor and fstrength.
Laws
These two equations must hold.
ffmapelim2. fstrength =elim2:: Day (ff g)Identity~> ff g fstrength .trans1fstrength = ffmapassoc. fstrength .disassoc:: Day (Day (ff g) h) k ~> ff (Day (Day g h) k))
Alternatively, these diagrams must commute.
fstrength
ff g ⊗ Identity -----------> ff (g ⊗ Identity)
\ |
\ | ffmap elim2
\ |
elim2 \ v
\----------------> ff g trans1 fstrength fstrength
(ff g ⊗ h) ⊗ k --------------------> ff (g ⊗ h) ⊗ k -----------> ff ((g ⊗ h) ⊗ k)
| ^
| disassoc ffmap assoc |
| |
v fstrength |
ff g ⊗ (h ⊗ k) ---------------------------------------------------> ff (g ⊗ (h ⊗ k))For readability, an infix operator (⊗) was used instead of the type constructor Day@.
mapCurried :: (Functor g, Functor h) => Curried g h ~> Curried (ff g) (ff h) Source #
Internal ffmap.
mapCurried can be seen as ffmap but by using "internal language" of
\(\mathrm{Hask}^{\mathrm{Hask}}\), the category of Functors.
ffmap :: (g ~> h) -> (ff g ~> ff h) mapCurried :: (Curried g h) ~> (Curried (ff g) (ff h))
ffmap takes a natural transformations (~>), in other words morphism in \(\mathrm{Hask}^{\mathrm{Hask}}\),
and returns another (~>). ffmap itself is an usual function, which is an outsider for
\(\mathrm{Hask}^{\mathrm{Hask}}\).
On the other hand, mapCurried is a natural transformation (~>) between Curried _ _,
objects of \(\mathrm{Hask}^{\mathrm{Hask}}\).
The existence of mapCurried is known to be equivalent to the existence of
fstrength.
Laws
These equations must hold.
mapCurried .unitCurried=unitCurried:: Identity ~> Curried (ff g) (ff g) mapCurried .composeCurried=composeCurried. trans1 mapCurried . trans2 mapCurried :: Day (Curried g h) (Curried h k) ~> Curried (ff g) (ff k)
Instances
fstrength' :: (FStrong ff, Functor h) => Day g (ff h) ~> ff (Day g h) Source #
fstrength but from left
innerAp :: (FStrong ff, Applicative h) => ff h (a -> b) -> h a -> ff h b Source #
Combine an applicative action(s) inside ff to another action h a.