Hoogle Search
Within LTS Haskell 24.69 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
solomap :: Solomap a b x y => (a -> b) -> x -> ygeneric-functor Generic.Functor.Internal Generalized implicit functor. Use this when x and y are applications of existing functors (Functor, Bifunctor). This is a different use case from gfmap and gsolomap, which make functors out of freshly declared data types. solomap is unsafe: misuse will break your programs. See the Usage section of gsolomap for details.
Example
map1 :: (a -> b) -> Either e (Maybe [IO a]) -> Either e (Maybe [IO b]) map1 = solomap -- equivalent to: fmap . fmap . fmap . fmap map2 :: (a -> b) -> (e -> Either [a] r) -> (e -> Either [b] r) map2 = solomap -- equivalent to: \f -> fmap (bimap (fmap f) id)
class MultimapOf (->) arr x y =>
MultimapI arr x ygeneric-functor Generic.Functor.Internal.Implicit Core of multimap.
class Multimap_ cat S2 arr x y =>
MultimapOf (cat :: Type -> Type -> Type) arr x ygeneric-functor Generic.Functor.Internal.Implicit No documentation available.
class
Multimap_ (cat :: Type -> Type -> Type) arr x ygeneric-functor Generic.Functor.Internal.Implicit Internal implementation of MultimapOf.
catbimap :: BifunctorOf cat t => cat a b -> cat c d -> cat (t a c) (t b d)generic-functor Generic.Functor.Internal.Implicit No documentation available.
catmap :: FunctorOf cat t => cat a b -> cat (t a) (t b)generic-functor Generic.Functor.Internal.Implicit No documentation available.
multimapI :: MultimapI arr x y => arr -> x -> ygeneric-functor Generic.Functor.Internal.Implicit Core of multimap
multimapOf :: MultimapOf cat arr x y => arr -> cat x ygeneric-functor Generic.Functor.Internal.Implicit No documentation available.
multimap_ :: Multimap_ cat arr x y => arr -> cat x ygeneric-functor Generic.Functor.Internal.Implicit No documentation available.
module Generic.Functor.
Multimap Generalized functors, where the type parameter(s) may be nested in arbitrary compositions of functors. Note that these functions are unsafe because they rely on incoherent instances. See the Usage section of gsolomap for details.
Example
{-# LANGUAGE DeriveGeneric #-} module Main where import Generic.Functor import GHC.Generics (Generic) data T a b = C Int a b deriving (Show, Generic) fmapT :: (b -> b') -> T a b -> T a b' fmapT = gsolomap firstT :: (a -> a') -> T a b -> T a' b firstT = gsolomap bothT :: (a -> a') -> T a a -> T a' a' bothT = gsolomap watT :: (a -> a') -> T (a , a ) ((a -> a') -> Maybe a ) -> T (a', a') ((a' -> a ) -> Maybe a') watT = gsolomap -- Incoherence test main :: IO () main = do print (fmapT ((+1) :: Int -> Int) (C 0 0 0 :: T Int Int)) print (gsolomap ((+1) :: Int -> Int) (C 0 0 0 :: T Int Int) :: T Int Int) -- NB: Type annotations are needed on both the input and output T Int Int. putStrLn "We are not the same." -- Output: -- C 0 0 1 -- C 1 1 1 -- We are not the same.