3 ms·
No, clash supports higher-order functions just fine. The only thing it can’t really represent is general recursion. You need to use type-constrained recursion.
by centimeter 6y ago
No, clash supports higher-order functions just fine. The only thing it can’t really represent is general recursion. You need to use type-constrained recursion. Clash isn’t fully generalized yet so it provides some nice bounded recursion primitive.
- zozbot234 6y agoYes, but the Clash reference documentation states that it doesn't do behavioral synthesis. It structurally maps the representation of the supported subset of fully-applied Haskell functions to either combinational or sequential circuits, depending on whether the function takes a `Signal`-type argument. The fact that the representation is shared leads to many advantages compared to e.g. Chisel, but this is definitely a "shallow embedding" approach.
- centimeter 6y ago"Signal" is just [] without an empty constructor (i.e. a lazy corecursive stream). As far as your Haskell code is concerned, there is nothing special whatsoever about signals, and indeed it's just a normal data type until the Clash-specific Core layer kicks in. I think I mixed up "shallow" and "deep" embedding - by "deep embedding", I meant to say that there is no secondary AST manually defined for the embedded language, but I think that is actually a shallow embedding. Looks like I can't correct my earlier comment. Only the top level function has to be first order - you can use higher order functions within the body of your code.