packages feed

comonad-coactions-0.1.0.0: src/Control/Comonad/Coaction/Right.hs

{-# LANGUAGE MonoLocalBinds #-}

-- | Operators for left comonad coactions.
--   This module should be imported qualified.
module Control.Comonad.Coaction.Right
  ( (<<=),
    (=>>),
    (=>=),
    (=<=),
  )
where

import Control.Comonad.Coaction

infixl 1 =>>

infixr 1 <<=, =<=, =>=

-- | @'rextend'@ in operator form.
(<<=) :: (RightComodule w f) => (w a -> b) -> f a -> f b
(<<=) = rextend
{-# INLINE (<<=) #-}

-- | @'rextend'@ with arguments swapped.
(=>>) :: (RightComodule w f) => f a -> (w a -> b) -> f b
(=>>) = flip rextend
{-# INLINE (=>>) #-}

-- | Left to right Cokleisli arrow scalar multiplication induced by a right comonad coaction.
(=>=) :: (RightComodule w f) => (w a -> b) -> (f b -> c) -> f a -> c
f =>= g = g . rextend f
{-# INLINE (=>=) #-}

-- | Right to left Cokleisli arrow scalar multiplication induced by a right comonad coaction.
(=<=) :: (RightComodule w f) => (f b -> c) -> (w a -> b) -> f a -> c
f =<= g = f . rextend g
{-# INLINE (=<=) #-}