-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fails Generating VHDL When Typeclass Has Many Instances #1721
Comments
What's causing the error is a bug in Clash' implementation of type family reduction, specifically, it doesn't handle nested type families. So given this even smaller reproducer: module T1721 where
import Clash.Prelude
type family G a
type instance G () = Bool
type family F a
data T a = T a
data TP a = TP Bool
type instance F (T Bool) = TP Bool
f :: F (T (G ()))
-> F (T (G ()))
f = id
{-# NOINLINE f #-}
topEntity :: F (T (G ()))
-> F (T (G ()))
topEntity = f Clash doesn't think there's any matching instance for |
christiaanb
added a commit
that referenced
this issue
Mar 26, 2021
christiaanb
added a commit
that referenced
this issue
Mar 26, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The compiler will fail to generate an output port on noinlined functions when a typeclass has many specialized instances.
It's suspected that the compiler skips generating an output port if the output of a function is one of many instances. Without the output port, the Netlist generator thinks the function is being applied to too many I/O components and throws an UnderApplied error.
An example is given in the attached file (this will fail to generate, and dump a long Core message).
clash-fix.zip
The text was updated successfully, but these errors were encountered: