playground/clash/list-to-vec.hs

27 lines
602 B
Haskell
Raw Normal View History

2024-02-25 07:05:53 +00:00
import Clash.Prelude
import Clash.Sized.Vector
import Clash.Explicit.Testbench
sz = 3
l :: [Int]
l = [0, 1, 2, 3, 4, 5]
v = unsafeFromList l :: Vec sz Int
{-
list-to-vec.hs:10:5-20: error:
No instance for (KnownNat sz1)
arising from a use of unsafeFromList
Possible fix:
add (KnownNat sz1) to the context of
an expression type signature:
forall (sz1 :: Nat). Vec sz1 Int
In the expression: unsafeFromList l :: Vec sz Int
In an equation for v: v = unsafeFromList l :: Vec sz Int
|
Compilation failed.
-}