Skip to content

Commit

Permalink
Merge pull request #1 from satnam6502/satnam6502
Browse files Browse the repository at this point in the history
Add documentation for fork and loop
  • Loading branch information
satnam6502 authored May 24, 2024
2 parents 91233fb + 0fb747c commit 73d76a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Lava.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
-- Stability: experimental
-- Portability: portable
--
-- A DSL for digital hardware design in Haskell.
-- The Lava module provides a DSL for digital hardware design.
--

module Lava (module Lava.Combinators,
Expand Down
7 changes: 6 additions & 1 deletion src/Lava/Combinators.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ where
import Control.Monad.Fix (MonadFix)
import Control.Monad ((>=>))

-- | Fork captures sharing.
-- | Fork captures sharing. The input wire `a` is split
-- into two wires, each containing the value of `a`.
fork :: Monad m => a -> m (a, a)
fork a = return (a, a)

-- | Loop is used to bend a wire `feedback` from the output of a circuit
-- and feed it back as in input to a circuit. This requires
-- the feedback path to contain at least one state (delay)
-- element, otherwise the output will not terminate.
loop :: MonadFix m => ((a, feedback) -> m (b, feedback)) ->
a -> m b
loop circuit a
Expand Down

0 comments on commit 73d76a3

Please sign in to comment.