Skip to content

IdleCircuit should be split up #154

@martijnbastiaan

Description

@martijnbastiaan

IdleCircuit is currently defined as:

{- | Idle state of a Circuit. Aims to provide no data for both the forward and
backward direction. Transactions are not acknowledged.
-}
class (Protocol p) => IdleCircuit p where
  idleFwd :: Proxy p -> Fwd (p :: Type)
  idleBwd :: Proxy p -> Bwd (p :: Type)

I.e., it forces instances to define both their Fwd and Bwd to be defined simultaneously. This doesn't make sense for protocols such as CSignal. I think it should be split up in:

class (Protocol p) => IdleFwd p where
  idleFwd :: Proxy p -> Fwd (p :: Type)

class (Protocol p) => IdleBwd p where
  idleBwd :: Proxy p -> Bwd (p :: Type)

idleSource :: forall p. (IdleFwd p) => Circuit () p
idleSource = Circuit $ const ((), idleFwd $ Proxy @p)

idleSink :: forall p. (IdleBwd p) => Circuit p ()
idleSink = Circuit $ const (idleBwd $ Proxy @p, ())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions