Skip to content

Commit b3d2f91

Browse files
committed
Change Signal.fromList's tail to pure (error "..")
After the provided list runs out, the tail of the signal is an infinite signal filled with error calls. This makes sure that a simulation that happens to not use the values in this signal can still make progress.
1 parent 97e1853 commit b3d2f91

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clash-prelude/src/Clash/Signal/Internal.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1690,7 +1690,7 @@ sampleN n = take n . sample
16901690
--
16911691
-- __NB__: This function is not synthesizable
16921692
fromList :: (HasCallStack,NFDataX a) => [a] -> Signal dom a
1693-
fromList = Prelude.foldr (\a b -> deepseqX a (a :- b)) (error "finite list")
1693+
fromList = Prelude.foldr (\a b -> deepseqX a (a :- b)) (pure $ error "finite list")
16941694

16951695
-- * Simulation functions (not synthesizable)
16961696

@@ -1749,7 +1749,7 @@ sampleN_lazy n = take n . sample_lazy
17491749
--
17501750
-- __NB__: This function is not synthesizable
17511751
fromList_lazy :: HasCallStack => [a] -> Signal dom a
1752-
fromList_lazy = Prelude.foldr (:-) (error "finite list")
1752+
fromList_lazy = Prelude.foldr (:-) (pure $ error "finite list")
17531753

17541754
-- * Simulation functions (not synthesizable)
17551755

0 commit comments

Comments
 (0)