{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Semigroupoids.Do
( (>>=),
(>>),
fail,
fmap,
(<*>),
join,
mfix,
return,
)
where
import Control.Monad.Fix (mfix)
import Data.Functor.Apply (Apply ((<.>)))
import Data.Functor.Bind (Bind ((>>-)))
import qualified Data.Functor.Bind as Bind
import Data.Functor.Plus (Plus (zero))
import Data.Kind (Type)
import Prelude hiding
( fail,
return,
(<*>),
(>>),
(>>=),
)
(>>=) ::
forall (m :: Type -> Type) (a :: Type) (b :: Type).
(Bind m) =>
m a ->
(a -> m b) ->
m b
>>= :: forall (m :: * -> *) a b. Bind m => m a -> (a -> m b) -> m b
(>>=) = m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Bind m => m a -> (a -> m b) -> m b
(>>-)
(>>) ::
forall (m :: Type -> Type) (a :: Type) (b :: Type).
(Bind m) =>
m a ->
m b ->
m b
m a
x >> :: forall (m :: * -> *) a b. Bind m => m a -> m b -> m b
>> m b
y = m a
x m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Bind m => m a -> (a -> m b) -> m b
>>- m b -> a -> m b
forall a b. a -> b -> a
const m b
y
fail ::
forall (m :: Type -> Type) (a :: Type).
(Plus m) =>
String ->
m a
fail :: forall (m :: * -> *) a. Plus m => String -> m a
fail String
_ = m a
forall (f :: * -> *) a. Plus f => f a
zero
(<*>) ::
forall (f :: Type -> Type) (a :: Type) (b :: Type).
(Apply f) =>
f (a -> b) ->
f a ->
f b
<*> :: forall (f :: * -> *) a b. Apply f => f (a -> b) -> f a -> f b
(<*>) = f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Apply f => f (a -> b) -> f a -> f b
(<.>)
join ::
forall (m :: Type -> Type) (a :: Type).
(Bind m) =>
m (m a) ->
m a
join :: forall (m :: * -> *) a. Bind m => m (m a) -> m a
join = m (m a) -> m a
forall (m :: * -> *) a. Bind m => m (m a) -> m a
Bind.join
return ::
forall (f :: Type -> Type) (a :: Type).
(Applicative f) =>
a ->
f a
return :: forall (f :: * -> *) a. Applicative f => a -> f a
return = a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure