Closed conal closed 1 year ago
Right, this is the error we were stuck with originally. I'll try to look at this again. I'm not completely convinced the this is really a problem in buildDictionary though, because I think the trace of rules fired diverges between the GHC versions even before.
The failure here is unexpected, since the needed constraint ((ProductCat (->), Ok2 (->) Double Double)
) holds (is inhabited). Another oddity is that the type isn't even well-kinded, since it ends in (->)
which doesn't have kind *
.
Hi, This may or may not be related to this issue. I'm using GHC 8.0.2 and getting a similar error message.
I was giving the library a try and couldn't get my first custom Category instance to work, although calling toCcc' does work for simply translating a lambda to itself. Do I need to define all the instance like CoproductCat and UnitCat to get the plugin to work? Or is this a bug?
Thanks! Love what this project is doing!
https://github.com/philzook58/concat-template/blob/master/app/Main.hs
(GHC version 8.0.2 for x86_64-apple-darwin):
ccc - couldn't build dictionary for
id @ FreeCat @ Any :: (Category FreeCat, Ok FreeCat Any) =>
FreeCat Any Any:
free id types: [Category FreeCat]
instance Category (FreeCat) where
-- type Ok (FreeCat) = ()
id = Id
(.) = Comp
data FreeCat a b where
Id :: FreeCat a a
Comp :: FreeCat b c -> FreeCat a b -> FreeCat a c
Par :: FreeCat a b -> FreeCat c d -> FreeCat (a,c) (b,d)
Exl :: FreeCat (a,b) a
Exr :: FreeCat (a,b) b
Dup :: FreeCat a (a,a)
main :: IO ()
main = do
putStrLn $ show $ (toCcc' (\(x, y) -> (y, x))) ("larry", "fred")-- Conversion of lambda to itself. Seems to work
-- putStrLn $ show $ freecat $ ((toCcc' (\x -> x))) -- Does not work
putStrLn $ show $ (((toCcc' (\x -> x))) :: FreeCat a a ) -- does not work
@philzook58 I bet the problem here is issue #2.
This issue was fixed by #45, right?
Hm. I don't know.
There's been lots of work on dictionary construction, and no current problems are known.
After this commit getting past issue #41 (with
ctev_nosh = WOnly
), I get a little further. The next error message I get is from the plugin itself, reporting that dictionary construction failed:I tested by running
stack build :misc-examples
with only the following example enabled in test/Examples.hs: