Closed christiaanb closed 8 months ago
As a work-around you can simply make the implicit arguments explicit:
module Test where
import Clash.Prelude
topEntity ::
Clock System ->
Signal System (Index (DomainPeriod System))
topEntity clk = withClock clk foo
foo ::
HiddenClock System =>
Signal System (Index (DomainPeriod System))
foo = dflipflop (pure maxBound)
Duplicate of https://github.com/clash-lang/clash-compiler/issues/1028?
It is.
The following:
fails with:
Looking at the debug log, there's really no hope:
The
KnownDomain System
is passed in as an argument at the top-level.The problem is: https://github.com/clash-lang/clash-compiler/blob/5e01ae2aec13f7b91cc8a6f5475feb4f24bf50b5/clash-prelude/src/Clash/Signal.hs#L602-L604 Where we combine an implicit parameter and a class constraint in a single constraint.
The solution to the class constraint should be unique, so really we shouldn't have a
KnownDomain System
argument. But because GHC encodes the combination of the implicit parameter and the class constraint as a constraint tuple, we don't get a "partial" solution.