I'm digging around in the Haskell Lava HDL system and am stuck in understanding http://hackage.haskell.org/package/chalmers-lava2000-1.6.1/docs/src/Lava-Vhdl.html#writeVhdl
Can someone tell me what function (var "inp")
in writeVhdl
resolves to?
Function var
is not defined yet and seems to be generated with some meta-programming that is not familiar to me in class Constructive
in http://hackage.haskell.org/package/chalmers-lava2000-1.6.1/docs/src/Lava-Generic.html#line-253 .
Function var
seems to act like a constructor. How is this mechanism working?
The input to writeVhdl
is a circuit description like
halfAdd (a, b) = (sum, arry)
where
sum = xor2 (a, b)
arry = and2 (a, b)
Can someone tell me what function (var "inp") in writeVhdlresolves to?
It depends on what you pass to writeVhdl
2nd argument, namely circ
. The type of its argument (if I read that correctly) is exactly the type that gets returned by var "foo"
.
You can observe expression types in ghci
by typing :t some expression
. Try loading your code into GHCi session and play with :t
command.