packages feed

comonad-coactions-0.1.0.1: src/Control/Comonad/Coaction/Left.hs

{-|
Module      : Control.Comonad.Coaction.Left
Description : operators for left comonad coactions
Copyright   : © noiioiu
License     : LGPL-2
Maintainer  : noiioiu@cocaine.ninja
Stability   : experimental

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

import Control.Comonad.Coaction

infixl 1 =>>

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

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

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

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

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