Skip to content

Commit

Permalink
Merge pull request #111 from bgamari/wip/nom
Browse files Browse the repository at this point in the history
Df: Add consume combinator
  • Loading branch information
bgamari authored Sep 9, 2024
2 parents 5645f14 + 5334f26 commit 64a0a58
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions clash-protocols/src/Protocols/Df.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module Protocols.Df (
-- * Operations on Df protocol
empty,
const,
consume,
void,
pure,
map,
Expand Down Expand Up @@ -370,6 +371,10 @@ empty = Circuit (P.const ((), P.pure NoData))
pure :: a -> Circuit () (Df dom a)
pure a = Circuit (P.const ((), P.pure (Data a)))

-- | Always acknowledge and ignore values.
consume :: (C.HiddenReset dom) => Circuit (Df dom a) ()
consume = Circuit (P.const (P.pure (Ack True), ()))

-- | Never acknowledge values.
void :: (C.HiddenReset dom) => Circuit (Df dom a) ()
void =
Expand Down

0 comments on commit 64a0a58

Please sign in to comment.