Skip to content

Commit

Permalink
Merge pull request #40 from cdepillabout/add-ixmonad
Browse files Browse the repository at this point in the history
Add IxMonad and Monad instances for Render
  • Loading branch information
megamaddu authored Sep 30, 2020
2 parents 00a4b2d + 7704a04 commit 9764ddd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/React/Basic/Hooks/Internal.purs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Prelude hiding (bind)
import Control.Applicative.Indexed (class IxApplicative)
import Control.Apply.Indexed (class IxApply)
import Control.Bind.Indexed (class IxBind, ibind)
import Control.Monad.Indexed (class IxMonad)
import Data.Functor.Indexed (class IxFunctor)
import Data.Newtype (class Newtype)
import Effect (Effect)
Expand Down Expand Up @@ -148,6 +149,8 @@ instance ixApplicativeRender :: IxApplicative Render where
instance ixBindRender :: IxBind Render where
ibind (Render m) f = Render (Prelude.bind m \a -> case f a of Render b -> b)

instance ixMonadRender :: IxMonad Render

-- | Exported for use with qualified-do syntax
bind :: forall a b x y z m. IxBind m => m x y a -> (a -> m y z b) -> m x z b
bind = ibind
Expand All @@ -168,6 +171,8 @@ instance applicativeRender :: TypeEquals x y => Applicative (Render x y) where
instance bindRender :: TypeEquals x y => Bind (Render x y) where
bind (Render m) f = Render (Prelude.bind m \a -> case f a of Render b -> b)

instance monadRender :: TypeEquals x y => Monad (Render x y)

instance semigroupRender :: (TypeEquals x y, Semigroup a) => Semigroup (Render x y a) where
append (Render a) (Render b) = Render (append a b)

Expand Down

0 comments on commit 9764ddd

Please sign in to comment.