File tree 2 files changed +13
-8
lines changed
2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -1680,15 +1680,15 @@ lazyV = lazyV' (repeat undefined)
1680
1680
-- >>> let append' xs ys = foldr (:>) ys xs
1681
1681
-- <BLANKLINE>
1682
1682
-- <interactive>:...
1683
- -- • Occurs check: cannot construct the infinite type: t ~ t + 1
1684
- -- Expected type: a -> Vec t a -> Vec t a
1685
- -- Actual type: a -> Vec t a -> Vec (t + 1) a
1683
+ -- • Occurs check: cannot construct the infinite type: ... ~ ... + 1
1684
+ -- Expected type: a -> Vec ... a -> Vec ... a
1685
+ -- Actual type: a -> Vec ... a -> Vec (... + 1) a
1686
1686
-- • In the first argument of ‘foldr’, namely ‘(:>)’
1687
1687
-- In the expression: foldr (:>) ys xs
1688
1688
-- In an equation for ‘append'’: append' xs ys = foldr (:>) ys xs
1689
1689
-- • Relevant bindings include
1690
- -- ys :: Vec t a (bound at ...)
1691
- -- append' :: Vec n a -> Vec t a -> Vec t a
1690
+ -- ys :: Vec ... a (bound at ...)
1691
+ -- append' :: Vec n a -> Vec ... a -> Vec ... a
1692
1692
-- (bound at ...)
1693
1693
--
1694
1694
-- The reason is that the type of 'foldr' is:
Original file line number Diff line number Diff line change @@ -84,9 +84,14 @@ import Data.Default
84
84
{- $setup
85
85
>>> :set -XTemplateHaskell
86
86
>>> :set -XDataKinds
87
- >>> let ma acc (x,y) = acc + x * y
88
87
>>> :{
89
- let macT acc (x,y) = (acc',o)
88
+ let ma :: Num a => a -> (a, a) -> a
89
+ ma acc (x,y) = acc + x * y
90
+ :}
91
+
92
+ >>> :{
93
+ let macT :: Num a => a -> (a,a) -> (a,a)
94
+ macT acc (x,y) = (acc',o)
90
95
where
91
96
acc' = ma acc (x,y)
92
97
o = acc
@@ -427,7 +432,7 @@ Going back to the original specification we note the following:
427
432
When we examine the type of 'macT' we see that is still completely combinational:
428
433
429
434
>>> :t macT
430
- macT :: Num t => t -> (t, t ) -> (t, t )
435
+ macT :: Num a => a -> (a, a ) -> (a, a )
431
436
432
437
The "CLaSH.Prelude" library contains a function that creates a sequential
433
438
circuit from a combinational circuit that has the same Mealy machine type /
You can’t perform that action at this time.
0 commit comments