playground/clash/list-to-vec.hs

27 lines
602 B
Haskell
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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.
-}