1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
module Prolog
(
-- * Modules
module Control.Applicative
, module Control.Monad
, module Control.Monad.Identity
, module Control.Monad.IO.Class
, module Data.Bool
, module Data.Either
, module Data.Function
, module Data.Functor
, module Data.Maybe
-- * Types
, Generic
, Generic1
, Typeable
, Generically (..)
, IsString (..)
-- * Functions
, ffmap
, (<<$>>)
, (<<&>>)
) where
import Control.Applicative
import Control.Monad
import Control.Monad.Identity
import Control.Monad.IO.Class
import Data.Bool
import Data.Either
import Data.Function
import Data.Functor
import Data.Maybe
import Data.Typeable (Typeable)
import Data.String (IsString (..))
import GHC.Generics
-- | 'fmap' over nested functors
ffmap :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
ffmap = fmap fmap fmap
{-# INLINE ffmap #-}
-- | infix version of 'fmap'
(<<$>>) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
infixl 4 <<$>>
(<<$>>) = ffmap
{-# INLINE (<<$>>) #-}
-- | flipped '(<<$>>)'
(<<&>>) :: (Functor f, Functor g) => f (g a) -> (a -> b) -> f (g b)
infixl 1 <<&>>
(<<&>>) = flip (<<$>>)
{-# INLINE (<<&>>) #-}
|