{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
module Data.Semigroup.Action
( SAct(..)
)
where
import Data.Semigroup (Semigroup, (<>))
class Semigroup s => SAct s x where
(<|) :: x -> s -> x
infixr 5 <|
instance Semigroup s => SAct s s where
<| :: s -> s -> s
(<|) = s -> s -> s
forall s. Semigroup s => s -> s -> s
(<>)
instance SAct s x => SAct s (y -> x) where
y -> x
f <| :: (y -> x) -> s -> y -> x
<| s
s = \y
y -> y -> x
f y
y x -> s -> x
forall s x. SAct s x => x -> s -> x
<| s
s