{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Fresnel.Functor.Traversed
(
runTraversed
, Traversed(..)
) where
import Data.Functor (void)
runTraversed :: Functor f => Traversed f a -> f ()
runTraversed :: Traversed f a -> f ()
runTraversed (Traversed f a
fa) = f a -> f ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void f a
fa
newtype Traversed f a = Traversed (f a)
deriving (Functor (Traversed f)
a -> Traversed f a
Functor (Traversed f)
-> (forall a. a -> Traversed f a)
-> (forall a b.
Traversed f (a -> b) -> Traversed f a -> Traversed f b)
-> (forall a b c.
(a -> b -> c) -> Traversed f a -> Traversed f b -> Traversed f c)
-> (forall a b. Traversed f a -> Traversed f b -> Traversed f b)
-> (forall a b. Traversed f a -> Traversed f b -> Traversed f a)
-> Applicative (Traversed f)
Traversed f a -> Traversed f b -> Traversed f b
Traversed f a -> Traversed f b -> Traversed f a
Traversed f (a -> b) -> Traversed f a -> Traversed f b
(a -> b -> c) -> Traversed f a -> Traversed f b -> Traversed f c
forall a. a -> Traversed f a
forall a b. Traversed f a -> Traversed f b -> Traversed f a
forall a b. Traversed f a -> Traversed f b -> Traversed f b
forall a b. Traversed f (a -> b) -> Traversed f a -> Traversed f b
forall a b c.
(a -> b -> c) -> Traversed f a -> Traversed f b -> Traversed f c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
forall (f :: * -> *). Applicative f => Functor (Traversed f)
forall (f :: * -> *) a. Applicative f => a -> Traversed f a
forall (f :: * -> *) a b.
Applicative f =>
Traversed f a -> Traversed f b -> Traversed f a
forall (f :: * -> *) a b.
Applicative f =>
Traversed f a -> Traversed f b -> Traversed f b
forall (f :: * -> *) a b.
Applicative f =>
Traversed f (a -> b) -> Traversed f a -> Traversed f b
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> Traversed f a -> Traversed f b -> Traversed f c
<* :: Traversed f a -> Traversed f b -> Traversed f a
$c<* :: forall (f :: * -> *) a b.
Applicative f =>
Traversed f a -> Traversed f b -> Traversed f a
*> :: Traversed f a -> Traversed f b -> Traversed f b
$c*> :: forall (f :: * -> *) a b.
Applicative f =>
Traversed f a -> Traversed f b -> Traversed f b
liftA2 :: (a -> b -> c) -> Traversed f a -> Traversed f b -> Traversed f c
$cliftA2 :: forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> Traversed f a -> Traversed f b -> Traversed f c
<*> :: Traversed f (a -> b) -> Traversed f a -> Traversed f b
$c<*> :: forall (f :: * -> *) a b.
Applicative f =>
Traversed f (a -> b) -> Traversed f a -> Traversed f b
pure :: a -> Traversed f a
$cpure :: forall (f :: * -> *) a. Applicative f => a -> Traversed f a
$cp1Applicative :: forall (f :: * -> *). Applicative f => Functor (Traversed f)
Applicative, a -> Traversed f b -> Traversed f a
(a -> b) -> Traversed f a -> Traversed f b
(forall a b. (a -> b) -> Traversed f a -> Traversed f b)
-> (forall a b. a -> Traversed f b -> Traversed f a)
-> Functor (Traversed f)
forall a b. a -> Traversed f b -> Traversed f a
forall a b. (a -> b) -> Traversed f a -> Traversed f b
forall (f :: * -> *) a b.
Functor f =>
a -> Traversed f b -> Traversed f a
forall (f :: * -> *) a b.
Functor f =>
(a -> b) -> Traversed f a -> Traversed f b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Traversed f b -> Traversed f a
$c<$ :: forall (f :: * -> *) a b.
Functor f =>
a -> Traversed f b -> Traversed f a
fmap :: (a -> b) -> Traversed f a -> Traversed f b
$cfmap :: forall (f :: * -> *) a b.
Functor f =>
(a -> b) -> Traversed f a -> Traversed f b
Functor)
instance Applicative f => Semigroup (Traversed f a) where
Traversed f a
a1 <> :: Traversed f a -> Traversed f a -> Traversed f a
<> Traversed f a
a2 = f a -> Traversed f a
forall (f :: * -> *) a. f a -> Traversed f a
Traversed (f a
a1 f a -> f a -> f a
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> f a
a2)
instance Applicative f => Monoid (Traversed f a) where
mempty :: Traversed f a
mempty = f a -> Traversed f a
forall (f :: * -> *) a. f a -> Traversed f a
Traversed (a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Char] -> a
forall a. HasCallStack => [Char] -> a
error [Char]
"Traversed.mempty: value used"))