Skip to content

Commit

Permalink
Rewrite /\ to operate on different inputs.
Browse files Browse the repository at this point in the history
  • Loading branch information
solomon-b committed Jan 17, 2024
1 parent ea250aa commit 6621867
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions chat-bots/src/Data/Chat/Bot/Monoidal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,11 @@ nudgeLeft = nudge . Left
nudgeRight :: Monad m => Bot m s i' o' -> Bot m s (i \/ i') (o \*/ o')
nudgeRight = nudge . Right

-- | Tuple the states and outputs of two bots who operate on the same
-- input @i@.
-- | Tuple the states and i/o of two bots.
infixr 9 /\

(/\) :: Monad m => Bot m s i o -> Bot m s' i o' -> Bot m (s /\ s') i (o /\ o')
(/\) b1 = lmap split' . curry Trifunctor.combine b1
(/\) :: Monad m => Bot m s i o -> Bot m s' i' o' -> Bot m (s /\ s') (i /\ i') (o /\ o')
(/\) b1 = curry Trifunctor.combine b1

-- | Runs two bots and then interleaves their output.
infixr 9 /+\
Expand Down

0 comments on commit 6621867

Please sign in to comment.