Skip to content

Commit 49f5bd3

Browse files
authored
Tutorial: mac alternatives share type (#2536)
Fixes #2533
1 parent 82442bb commit 49f5bd3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

clash-prelude/src/Clash/Tutorial.hs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ macT acc (x,y) = (acc',o)
515515
acc' = ma acc (x,y)
516516
o = acc
517517
518-
mac inp = 'mealy' macT 0 inp
518+
mac xy = 'mealy' macT 0 xy
519519
520520
topEntity
521521
:: 'Clock' 'System'
@@ -652,8 +652,9 @@ structure.
652652
function directly:
653653
654654
@
655-
macN (x,y) = acc
655+
macN xy = acc
656656
where
657+
(x,y) = 'unbundle' xy
657658
acc = 'register' 0 (acc + x * y)
658659
@
659660
@@ -665,10 +666,10 @@ structure.
665666
class:
666667
667668
@
668-
macA (x,y) = acc
669+
macA xy = acc
669670
where
670671
acc = 'register' 0 acc'
671-
acc' = ma '<$>' acc '<*>' 'bundle' (x,y)
672+
acc' = ma '<$>' acc '<*>' xy
672673
@
673674
674675
* __'Control.Monad.State.Strict.State' Monad__
@@ -706,7 +707,7 @@ structure.
706707
We can then create the complete @mac@ circuit as:
707708
708709
@
709-
macS = 'mealyS' macTS 0
710+
macS xy = 'mealyS' macTS 0 xy
710711
@
711712
-}
712713

0 commit comments

Comments
 (0)