compiling-to-categories / concat

Compiling to Categories
http://conal.net/papers/compiling-to-categories
BSD 3-Clause "New" or "Revised" License
436 stars 50 forks source link

build error on ghc 8.2.2 #36

Closed cartazio closed 6 years ago

cartazio commented 6 years ago

Hey Conal, so i'm poking at seeing if i can quickly hack out the symmetric monoidal variant of concat using your stuff as a foundation and (among several things) i hit the following error

src/ConCat/BuildDictionary.hs:123:38: error:
    Variable not in scope: uniqSetToList :: VarSet -> [EvId]
    |
123 |           let givens = mkGivens loc (uniqSetToList evIds)
    |                                      ^^^^^^^^^^^^^

src/ConCat/BuildDictionary.hs:164:74: error:
    Variable not in scope: uniqSetToList :: VarSet -> f1 Id
    |
164 |   pprTrace' "buildDictionary in-scope evidence" (ppr (WithType . Var <$> uniqSetToList scopedDicts)) $
    |                                                                          ^^^^^^^^^^^^^

src/ConCat/BuildDictionary.hs:206:31: error:
    Variable not in scope: uniqSetToList :: VarSet -> f Var
    |
206 |       freeIdTys = varType <$> uniqSetToList freeIds
cartazio commented 6 years ago

i'll patch it locally i suppose :)

conal commented 6 years ago

Thanks. There are some other issues as well. @kosmikus is helping to get concat working under 8.2 and later.

cartazio commented 6 years ago

some / most issues are fixed via https://github.com/conal/concat/pull/37, though some may remain, but code at least builds :)

cartazio commented 6 years ago

the gold tests + a few other stuff ran fine with my patch set using ghc 8.0 did get a few pdfs opening up :)

$ cabal new-test --with-ghc=$HOME/.install-ghc/ghc-8.0.2/bin/ghc-8.0.2  all --enable-tests
Resolving dependencies...
Build profile: -w ghc-8.0.2 -O1
In order, the following will be built (use -v for more details):
 - concat-examples-0.3.0.0 (test:gold-tests) (ephemeral targets)
 - concat-examples-0.3.0.0 (test:misc-examples) (ephemeral targets)
 - concat-examples-0.3.0.0 (test:misc-trace) (ephemeral targets)
 - concat-graphics-0.1.0.0 (test:graphics-examples) (ephemeral targets)
 - concat-graphics-0.1.0.0 (test:graphics-trace) (ephemeral targets)
 - concat-hardware-0.1.0.0 (test:hardware-examples) (ephemeral targets)
 - concat-hardware-0.1.0.0 (test:hardware-trace) (ephemeral targets)
Preprocessing test suite 'gold-tests' for concat-examples-0.3.0.0..
Preprocessing test suite 'graphics-examples' for concat-graphics-0.1.0.0..
Building test suite 'gold-tests' for concat-examples-0.3.0.0..
Building test suite 'graphics-examples' for concat-graphics-0.1.0.0..
Preprocessing test suite 'misc-examples' for concat-examples-0.3.0.0..
Building test suite 'misc-examples' for concat-examples-0.3.0.0..
Preprocessing test suite 'misc-trace' for concat-examples-0.3.0.0..
Building test suite 'misc-trace' for concat-examples-0.3.0.0..
Running 1 test suites...
Test suite graphics-examples: RUNNING...

graphics-examples: ConCat.GLSL.accumComps: oops: [CompS 895 "(0.0,0.0,0.0,0.0)" [] [Bus 895 0 Double,Bus 895 1 Double,Bus 895 2 Double,Bus 895 3 Double],CompS 896 "(1.0,1.0,1.0,1.0)" [] [Bus 896 0 Double,Bus 896 1 Double,Bus 896 2 Double,Bus 896 3 Double],CompS 897 "if" [Bus 894 0 Bool,Bus 895 0 Double,Bus 896 0 Double] [Bus 897 0 Double],CompS 898 "if" [Bus 894 0 Bool,Bus 895 1 Double,Bus 896 1 Double] [Bus 898 0 Double],CompS 899 "if" [Bus 894 0 Bool,Bus 895 2 Double,Bus 896 2 Double] [Bus 899 0 Double],CompS 900 "if" [Bus 894 0 Bool,Bus 895 3 Double,Bus 896 3 Double] [Bus 900 0 Double]]
CallStack (from HasCallStack):
  error, called at src/ConCat/Graphics/GLSL.hs:165:13 in concat-graphics-0.1.0.0-inplace:ConCat.Graphics.GLSL
Test suite graphics-examples: FAIL
Test suite logged to:
/Users/carter/WorkSpace/projects/active/concat-linear-work/dist-newstyle/build/x86_64-osx/ghc-8.0.2/concat-graphics-0.1.0.0/t/graphics-examples/test/concat-graphics-0.1.0.0-graphics-examples.log
0 of 1 test suites (0 of 1 test cases) passed.
Preprocessing test suite 'graphics-trace' for concat-graphics-0.1.0.0..
Building test suite 'graphics-trace' for concat-graphics-0.1.0.0..
Running 1 test suites...
Test suite misc-trace: RUNNING...
Running 1 test suites...
Test suite misc-examples: RUNNING...
Running 1 test suites...
Test suite graphics-trace: RUNNING...

graphics-trace: ConCat.GLSL.accumComps: oops: [CompS 895 "(0.0,0.0,0.0,0.0)" [] [Bus 895 0 Double,Bus 895 1 Double,Bus 895 2 Double,Bus 895 3 Double],CompS 896 "(1.0,1.0,1.0,1.0)" [] [Bus 896 0 Double,Bus 896 1 Double,Bus 896 2 Double,Bus 896 3 Double],CompS 897 "if" [Bus 894 0 Bool,Bus 895 0 Double,Bus 896 0 Double] [Bus 897 0 Double],CompS 898 "if" [Bus 894 0 Bool,Bus 895 1 Double,Bus 896 1 Double] [Bus 898 0 Double],CompS 899 "if" [Bus 894 0 Bool,Bus 895 2 Double,Bus 896 2 Double] [Bus 899 0 Double],CompS 900 "if" [Bus 894 0 Bool,Bus 895 3 Double,Bus 896 3 Double] [Bus 900 0 Double]]
CallStack (from HasCallStack):
  error, called at src/ConCat/Graphics/GLSL.hs:165:13 in concat-graphics-0.1.0.0-inplace:ConCat.Graphics.GLSL
Test suite graphics-trace: FAIL
Test suite logged to:
/Users/carter/WorkSpace/projects/active/concat-linear-work/dist-newstyle/build/x86_64-osx/ghc-8.0.2/concat-graphics-0.1.0.0/t/graphics-trace/test/concat-graphics-0.1.0.0-graphics-trace.log
0 of 1 test suites (0 of 1 test cases) passed.
Running 1 test suites...
Test suite gold-tests: RUNNING...
basic tests
  add
    syntax:        OK
    circuit dot:   OK
  add-uncurry
    syntax:        OK
    circuit dot:   OK
  dup
    syntax:        OK
    circuit dot:   OK
  fst
    syntax:        OK
    circuit dot:   OK
  twice
    syntax:        OK
    circuit dot:   OK
  sqr
    syntax:        OK
    circuit dot:   OK
  complex-mul
    syntax:        OK
    circuit dot:   OK
  magSqr
    syntax:        OK
    circuit dot:   OK
  cosSinProd
    syntax:        OK
    circuit dot:   OK
  xp3y
    syntax:        OK
    circuit dot:   OK
  horner
    syntax:        OK
    circuit dot:   OK
  cos-2xx
    syntax:        OK
    circuit dot:   OK
  add-ders
    add-adf
      syntax:      OK
      circuit dot: OK
    add-adr
      syntax:      OK
      circuit dot: OK
    add-gradr
      syntax:      OK
      circuit dot: OK
  sin-ders
    sin-adf
      syntax:      OK
      circuit dot: OK
    sin-adr
      syntax:      OK
      circuit dot: OK
    sin-gradr
      syntax:      OK
      circuit dot: OK
  cos-ders
    cos-adf
      syntax:      OK
      circuit dot: OK
    cos-adr
      syntax:      OK
      circuit dot: OK
    cos-gradr
      syntax:      OK
      circuit dot: OK
  twice-ders
    twice-adf
      syntax:      OK
      circuit dot: OK
    twice-adr
      syntax:      OK
      circuit dot: OK
    twice-gradr
      syntax:      OK
      circuit dot: OK
  sqr-ders
    sqr-adf
      syntax:      OK
      circuit dot: OK
    sqr-adr
      syntax:      OK
      circuit dot: OK
    sqr-gradr
      syntax:      OK
      circuit dot: OK
  magSqr-ders
    magSqr-adf
      syntax:      OK
      circuit dot: OK (0.02s)
    magSqr-adr
      syntax:      OK (0.03s)
      circuit dot: OK (0.05s)
    magSqr-gradr
      syntax:      OK (0.03s)
      circuit dot: OK (0.15s)
  cos-2x-ders
    cos-2x-adf
      syntax:      OK
      circuit dot: OK
    cos-2x-adr
      syntax:      OK (0.02s)
      circuit dot: OK (0.01s)
    cos-2x-gradr
      syntax:      OK (0.01s)
      circuit dot: OK
  cos-2xx-ders
    cos-2xx-adf
      syntax:      OK (0.02s)
      circuit dot: OK (0.03s)
    cos-2xx-adr
      syntax:      OK (0.02s)
      circuit dot: OK (0.02s)
    cos-2xx-gradr
      syntax:      OK (0.02s)
      circuit dot: OK (0.03s)
  cos-xpy-ders
    cos-xpy-adf
      syntax:      OK
      circuit dot: OK
    cos-xpy-adr
      syntax:      OK
      circuit dot: OK
    cos-xpy-gradr
      syntax:      OK
      circuit dot: OK

All 78 tests passed (0.60s)
Test suite gold-tests: PASS
Test suite logged to:
/Users/carter/WorkSpace/projects/active/concat-linear-work/dist-newstyle/build/x86_64-osx/ghc-8.0.2/concat-examples-0.3.0.0/t/gold-tests/test/concat-examples-0.3.0.0-gold-tests.log
1 of 1 test suites (1 of 1 test cases) passed.

curry addC
Wrote add
dot -Gsize=10,10 -Tpdf out/add.dot -o out/add.pdf

apply . (curry addC . exl &&& exr)
Wrote add-uncurry
dot -Gsize=10,10 -Tpdf out/add-uncurry.dot -o out/add-uncurry.pdf

id &&& id
Wrote dup
dot -Gsize=10,10 -Tpdf out/dup.dot -o out/dup.pdf

exl
Wrote fst
dot -Gsize=10,10 -Tpdf out/fst.dot -o out/fst.pdf

addC . (id &&& id)
Wrote twice
dot -Gsize=10,10 -Tpdf out/twice.dot -o out/twice.pdf

mulC . (id &&& id)
Wrote sqr
dot -Gsize=10,10 -Tpdf out/sqr.dot -o out/sqr.pdf

apply .
(curry
 (apply .
  (curry
   (abst .
    (subC .
     (mulC . (exl . exr . exl &&& exl . exr) &&&
      mulC . (exr . exr . exl &&& exr . exr)) &&&
     addC .
     (mulC . (exl . exr . exl &&& exr . exr) &&&
      mulC . (exr . exr . exl &&& exl . exr))) .
    (id &&& repr . exr . exl) . (id &&& repr . exl)) .
   exl &&&
   exr)) .
 exl &&&
 exr)
Wrote complex-mul
dot -Gsize=10,10 -Tpdf out/complex-mul.dot -o out/complex-mul.pdf

addC . (mulC . (exl &&& exl) &&& mulC . (exr &&& exr))
Wrote magSqr
dot -Gsize=10,10 -Tpdf out/magSqr.dot -o out/magSqr.pdf

(cos &&& sin) . mulC
Wrote cosSinProd
dot -Gsize=10,10 -Tpdf out/cosSinProd.dot -o out/cosSinProd.pdf

addC . (exl &&& mulC . (const 3.0 &&& exr))
Wrote xp3y
dot -Gsize=10,10 -Tpdf out/xp3y.dot -o out/xp3y.pdf

addC .
(const 1.0 &&&
 mulC .
 (id &&&
  addC .
  (const 3.0 &&&
   mulC . (id &&& addC . (const 5.0 &&& mulC . (id &&& const 0.0))))))
Wrote horner
dot -Gsize=10,10 -Tpdf out/horner.dot -o out/horner.pdf

cos . mulC . (mulC . (const 2.0 &&& id) &&& id)
Wrote cos-2xx
dot -Gsize=10,10 -Tpdf out/cos-2xx.dot -o out/cos-2xx.pdf
Test suite misc-examples: PASS
Test suite logged to:
/Users/carter/WorkSpace/projects/active/concat-linear-work/dist-newstyle/build/x86_64-osx/ghc-8.0.2/concat-examples-0.3.0.0/t/misc-examples/test/concat-examples-0.3.0.0-misc-examples.log
1 of 1 test suites (1 of 1 test cases) passed.

curry addC
Wrote add
dot -Gsize=10,10 -Tpdf out/add.dot -o out/add.pdf

apply . (curry addC . exl &&& exr)
Wrote add-uncurry
dot -Gsize=10,10 -Tpdf out/add-uncurry.dot -o out/add-uncurry.pdf

id &&& id
Wrote dup
dot -Gsize=10,10 -Tpdf out/dup.dot -o out/dup.pdf

exl
Wrote fst
dot -Gsize=10,10 -Tpdf out/fst.dot -o out/fst.pdf

addC . (id &&& id)
Wrote twice
dot -Gsize=10,10 -Tpdf out/twice.dot -o out/twice.pdf

mulC . (id &&& id)
Wrote sqr
dot -Gsize=10,10 -Tpdf out/sqr.dot -o out/sqr.pdf

apply .
(curry
 (apply .
  (curry
   (abst .
    (subC .
     (mulC . (exl . exr . exl &&& exl . exr) &&&
      mulC . (exr . exr . exl &&& exr . exr)) &&&
     addC .
     (mulC . (exl . exr . exl &&& exr . exr) &&&
      mulC . (exr . exr . exl &&& exl . exr))) .
    (id &&& repr . exr . exl) . (id &&& repr . exl)) .
   exl &&&
   exr)) .
 exl &&&
 exr)
Wrote complex-mul
dot -Gsize=10,10 -Tpdf out/complex-mul.dot -o out/complex-mul.pdf

addC . (mulC . (exl &&& exl) &&& mulC . (exr &&& exr))
Wrote magSqr
dot -Gsize=10,10 -Tpdf out/magSqr.dot -o out/magSqr.pdf

(cos &&& sin) . mulC
Wrote cosSinProd
dot -Gsize=10,10 -Tpdf out/cosSinProd.dot -o out/cosSinProd.pdf

addC . (exl &&& mulC . (const 3.0 &&& exr))
Wrote xp3y
dot -Gsize=10,10 -Tpdf out/xp3y.dot -o out/xp3y.pdf

addC .
(const 1.0 &&&
 mulC .
 (id &&&
  addC .
  (const 3.0 &&&
   mulC . (id &&& addC . (const 5.0 &&& mulC . (id &&& const 0.0))))))
Wrote horner
dot -Gsize=10,10 -Tpdf out/horner.dot -o out/horner.pdf

cos . mulC . (mulC . (const 2.0 &&& id) &&& id)
Wrote cos-2xx
dot -Gsize=10,10 -Tpdf out/cos-2xx.dot -o out/cos-2xx.pdf
Test suite misc-trace: PASS
Test suite logged to:
/Users/carter/WorkSpace/projects/active/concat-linear-work/dist-newstyle/build/x86_64-osx/ghc-8.0.2/concat-examples-0.3.0.0/t/misc-trace/test/concat-examples-0.3.0.0-misc-trace.log
1 of 1 test suites (1 of 1 test cases) passed.
cabal: Tests failed for test:graphics-examples from concat-graphics-0.1.0.0.
Tests failed for test:graphics-trace from concat-graphics-0.1.0.0.
adamgundry commented 6 years ago

This issue can be closed, I think?

conal commented 6 years ago

Yep. Thanks.