nwf / dyna

Dyna2 compiler and REPL
GNU Affero General Public License v3.0
146 stars 20 forks source link

Build fails with `src/Dyna/Analysis/Mode/Execution/NamedInst.hs:257:37: Couldn't match type ‘b’ with ‘forall i_. InstF f1 i_’` #79

Open pyetras opened 9 years ago

pyetras commented 9 years ago

Here's the complete output from make:

alex --version 2>/dev/null >/dev/null || cabal install alex
happy --version 2>/dev/null >/dev/null || cabal install happy
cabal install --user --enable-tests --only-dependencies .
Resolving dependencies...
Configuring MonadRandom-0.3.0.1...
Configuring extensible-exceptions-0.1.1.4...
Configuring hostname-1.0...
Configuring language-haskell-extract-0.2.4...
Configuring logict-0.6.0.2...
Configuring polyparse-1.11...
Configuring recursion-schemes-4.1...
Configuring temporary-1.2.0.3...
Building hostname-1.0...
Building recursion-schemes-4.1...
Building language-haskell-extract-0.2.4...
Building polyparse-1.11...
Building logict-0.6.0.2...
Building MonadRandom-0.3.0.1...
Building extensible-exceptions-0.1.1.4...
Building temporary-1.2.0.3...
Installed extensible-exceptions-0.1.1.4
Configuring transformers-base-0.4.4...
Configuring wl-pprint-extras-3.5.0.4...
Installed hostname-1.0
Building transformers-base-0.4.4...
Configuring xml-1.3.14...
Installed language-haskell-extract-0.2.4
Building wl-pprint-extras-3.5.0.4...
Installed temporary-1.2.0.3
Building xml-1.3.14...
Installed transformers-base-0.4.4
Configuring monad-control-1.0.0.4...
Installed logict-0.6.0.2
Configuring smallcheck-1.1.1...
Building monad-control-1.0.0.4...
Installed MonadRandom-0.3.0.1
Building smallcheck-1.1.1...
Installed wl-pprint-extras-3.5.0.4
Configuring wl-pprint-terminfo-3.7.1.3...
Installed recursion-schemes-4.1
Installed monad-control-1.0.0.4
Configuring either-4.3.3.2...
Building either-4.3.3.2...
Building wl-pprint-terminfo-3.7.1.3...
Installed xml-1.3.14
Configuring test-framework-0.8.1.1...
Building test-framework-0.8.1.1...
Installed smallcheck-1.1.1
Installed either-4.3.3.2
Installed wl-pprint-terminfo-3.7.1.3
Installed test-framework-0.8.1.1
Configuring test-framework-golden-1.1.3.1...
Configuring test-framework-hunit-0.3.0.1...
Configuring test-framework-program-1.1...
Configuring test-framework-quickcheck2-0.3.0.3...
Building test-framework-hunit-0.3.0.1...
Building test-framework-quickcheck2-0.3.0.3...
Building test-framework-program-1.1...
Building test-framework-golden-1.1.3.1...
Installed polyparse-1.11
Configuring cpphs-1.18.9...
Installed test-framework-hunit-0.3.0.1
Installed test-framework-quickcheck2-0.3.0.3
Building cpphs-1.18.9...
Installed test-framework-program-1.1
Installed test-framework-golden-1.1.3.1
Installed cpphs-1.18.9
Configuring haskell-src-exts-1.16.0.1...
Building haskell-src-exts-1.16.0.1...
Installed haskell-src-exts-1.16.0.1
Configuring test-framework-th-0.2.4...
Building test-framework-th-0.2.4...
Installed test-framework-th-0.2.4
Updating documentation index
/Users/Pietras/Library/Haskell/share/doc/index.html
mkdir -p `dirname dist/VERSION`
echo "Version: Dyna 0.4 pre-release" `git describe --all` > dist/VERSION
echo "Build date:" `date` >> dist/VERSION
echo "Commit: https://github.com/nwf/dyna/commit/"`git rev-parse HEAD` >> dist/VERSION
cabal configure --user
Resolving dependencies...
Configuring dyna-0.4...
cabal build
Building dyna-0.4...
Preprocessing executable 'dyna' for dyna-0.4...
[ 1 of 37] Compiling Dyna.XXX.Automata.Class ( src/Dyna/XXX/Automata/Class.hs, dist/build/dyna/dyna-tmp/Dyna/XXX/Automata/Class.o )
[ 2 of 37] Compiling Dyna.XXX.MonadContext ( src/Dyna/XXX/MonadContext.hs, dist/build/dyna/dyna-tmp/Dyna/XXX/MonadContext.o )
[ 3 of 37] Compiling Dyna.XXX.PPrint  ( src/Dyna/XXX/PPrint.hs, dist/build/dyna/dyna-tmp/Dyna/XXX/PPrint.o )

src/Dyna/XXX/PPrint.hs:34:3: Warning:
    Pattern match(es) are non-exhaustive
    In an equation for ‘go’: Patterns not matched: SFail
[ 4 of 37] Compiling Dyna.XXX.MonadUtils ( src/Dyna/XXX/MonadUtils.hs, dist/build/dyna/dyna-tmp/Dyna/XXX/MonadUtils.o )

src/Dyna/XXX/MonadUtils.hs:21:1: Warning:
    The import of ‘Data.Monoid’ is redundant
      except perhaps to import instances from ‘Data.Monoid’
    To import instances alone, use: import Data.Monoid()
[ 5 of 37] Compiling Dyna.XXX.DataUtils ( src/Dyna/XXX/DataUtils.hs, dist/build/dyna/dyna-tmp/Dyna/XXX/DataUtils.o )
[ 6 of 37] Compiling Dyna.XXX.Automata.NamedAut ( src/Dyna/XXX/Automata/NamedAut.hs, dist/build/dyna/dyna-tmp/Dyna/XXX/Automata/NamedAut.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.5.0.0 ... linking ... done.
Loading package deepseq-1.3.0.2 ... linking ... done.
Loading package bytestring-0.10.4.0 ... linking ... done.
Loading package containers-0.5.5.1 ... linking ... done.
Loading package text-1.2.0.4 ... linking ... done.
Loading package hashable-1.2.3.1 ... linking ... done.
Loading package nats-1 ... linking ... done.
Loading package unordered-containers-0.2.5.1 ... linking ... done.
Loading package semigroups-0.16.2.2 ... linking ... done.
Loading package terminfo-0.4.0.0 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package stm-2.4.2 ... linking ... done.
Loading package StateVar-1.1.0.0 ... linking ... done.
Loading package mtl-2.1.3.1 ... linking ... done.
Loading package transformers-compat-0.4.0.3 ... linking ... done.
Loading package void-0.7 ... linking ... done.
Loading package contravariant-1.3 ... linking ... done.
Loading package tagged-0.7.3 ... linking ... done.
Loading package distributive-0.4.4 ... linking ... done.
Loading package comonad-4.2.3 ... linking ... done.
Loading package semigroupoids-4.3 ... linking ... done.
Loading package utf8-string-1 ... linking ... done.
Loading package wl-pprint-extras-3.5.0.4 ... linking ... done.
Loading package wl-pprint-terminfo-3.7.1.3 ... linking ... done.
Loading package old-locale-1.0.0.6 ... linking ... done.
Loading package time-1.4.2 ... linking ... done.
Loading package unix-2.7.0.1 ... linking ... done.
Loading package ansi-terminal-0.6.2.1 ... linking ... done.
Loading package ansi-wl-pprint-0.6.7.1 ... linking ... done.
Loading package blaze-builder-0.3.3.4 ... linking ... done.
Loading package blaze-markup-0.6.3.0 ... linking ... done.
Loading package blaze-html-0.7.1.0 ... linking ... done.
Loading package charset-0.3.7 ... linking ... done.
Loading package fingertree-0.1.0.1 ... linking ... done.
Loading package bifunctors-4.2.1 ... linking ... done.
Loading package exceptions-0.8.0.1 ... linking ... done.
Loading package filepath-1.3.0.2 ... linking ... done.
Loading package prelude-extras-0.4 ... linking ... done.
Loading package profunctors-4.4.1 ... linking ... done.
Loading package pretty-1.1.1.1 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package free-4.11 ... linking ... done.
Loading package adjunctions-4.2 ... linking ... done.
Loading package kan-extensions-4.2.1 ... linking ... done.
Loading package parallel-3.2.0.4 ... linking ... done.
Loading package primitive-0.5.2.1 ... linking ... done.
Loading package reflection-1.5.1.2 ... linking ... done.
Loading package vector-0.10.9.1 ... linking ... done.
Loading package lens-4.8 ... linking ... done.
Loading package scientific-0.3.3.7 ... linking ... done.
Loading package attoparsec-0.12.1.3 ... linking ... done.
Loading package parsec-3.1.8 ... linking ... done.
Loading package parsers-0.12.1.1 ... linking ... done.
Loading package keys-3.10.1 ... linking ... done.
Loading package data-default-class-0.0.1 ... linking ... done.
Loading package pointed-4.2 ... linking ... done.
Loading package reducers-3.10.3.1 ... linking ... done.
Loading package trifecta-1.5.1.3 ... linking ... done.
Loading package recursion-schemes-4.1 ... linking ... done.
Loading package directory-1.2.1.0 ... linking ... done.
Loading package process-1.2.0.0 ... linking ... done.
Loading package random-1.0.1.1 ... linking ... done.
Loading package MonadRandom-0.3.0.1 ... linking ... done.
Loading package transformers-base-0.4.4 ... linking ... done.
Loading package monad-control-1.0.0.4 ... linking ... done.
Loading package either-4.3.3.2 ... linking ... done.
Loading package HUnit-1.2.5.2 ... linking ... done.
[ 7 of 37] Compiling Dyna.XXX.Automata.Utilities ( src/Dyna/XXX/Automata/Utilities.hs, dist/build/dyna/dyna-tmp/Dyna/XXX/Automata/Utilities.o )

src/Dyna/XXX/Automata/Utilities.hs:11:1: Warning:
    The import of ‘Control.Arrow’ is redundant
      except perhaps to import instances from ‘Control.Arrow’
    To import instances alone, use: import Control.Arrow()

src/Dyna/XXX/Automata/Utilities.hs:12:1: Warning:
    The import of ‘Control.Lens’ is redundant
      except perhaps to import instances from ‘Control.Lens’
    To import instances alone, use: import Control.Lens()

src/Dyna/XXX/Automata/Utilities.hs:13:1: Warning:
    The import of ‘Control.Monad.State’ is redundant
      except perhaps to import instances from ‘Control.Monad.State’
    To import instances alone, use: import Control.Monad.State()

src/Dyna/XXX/Automata/Utilities.hs:17:1: Warning:
    The qualified import of ‘Data.Maybe’ is redundant
      except perhaps to import instances from ‘Data.Maybe’
    To import instances alone, use: import Data.Maybe()

src/Dyna/XXX/Automata/Utilities.hs:19:1: Warning:
    The import of ‘Dyna.XXX.Automata.NamedAut’ is redundant
      except perhaps to import instances from ‘Dyna.XXX.Automata.NamedAut’
    To import instances alone, use: import Dyna.XXX.Automata.NamedAut()

src/Dyna/XXX/Automata/Utilities.hs:35:35: Warning:
    This binding for ‘r’ shadows the existing binding
      bound at src/Dyna/XXX/Automata/Utilities.hs:33:8
[ 8 of 37] Compiling Dyna.Main.Defns  ( src/Dyna/Main/Defns.hs, dist/build/dyna/dyna-tmp/Dyna/Main/Defns.o )
[ 9 of 37] Compiling Paths_dyna       ( dist/build/autogen/Paths_dyna.hs, dist/build/dyna/dyna-tmp/Paths_dyna.o )
[10 of 37] Compiling Dyna.XXX.Trifecta ( src/Dyna/XXX/Trifecta.hs, dist/build/dyna/dyna-tmp/Dyna/XXX/Trifecta.o )

src/Dyna/XXX/Trifecta.hs:21:1: Warning:
    The import of ‘Text.Trifecta.Result’ is redundant
      except perhaps to import instances from ‘Text.Trifecta.Result’
    To import instances alone, use: import Text.Trifecta.Result()
[11 of 37] Compiling Dyna.Term.TTerm  ( src/Dyna/Term/TTerm.hs, dist/build/dyna/dyna-tmp/Dyna/Term/TTerm.o )
[12 of 37] Compiling Dyna.Term.SurfaceSyntax ( src/Dyna/Term/SurfaceSyntax.hs, dist/build/dyna/dyna-tmp/Dyna/Term/SurfaceSyntax.o )
[13 of 37] Compiling Dyna.Term.Normalized ( src/Dyna/Term/Normalized.hs, dist/build/dyna/dyna-tmp/Dyna/Term/Normalized.o )
[14 of 37] Compiling Dyna.Main.Exception ( src/Dyna/Main/Exception.hs, dist/build/dyna/dyna-tmp/Dyna/Main/Exception.o )
[15 of 37] Compiling Dyna.Analysis.Mode.Uniq ( src/Dyna/Analysis/Mode/Uniq.hs, dist/build/dyna/dyna-tmp/Dyna/Analysis/Mode/Uniq.o )
[16 of 37] Compiling Dyna.Analysis.Mode.Inst ( src/Dyna/Analysis/Mode/Inst.hs, dist/build/dyna/dyna-tmp/Dyna/Analysis/Mode/Inst.o )
[17 of 37] Compiling Dyna.ParserHS.Types ( src/Dyna/ParserHS/Types.hs, dist/build/dyna/dyna-tmp/Dyna/ParserHS/Types.o )
[18 of 37] Compiling Dyna.Analysis.Mode.InstPretty ( src/Dyna/Analysis/Mode/InstPretty.hs, dist/build/dyna/dyna-tmp/Dyna/Analysis/Mode/InstPretty.o )
[19 of 37] Compiling Dyna.ParserHS.Parser ( src/Dyna/ParserHS/Parser.hs, dist/build/dyna/dyna-tmp/Dyna/ParserHS/Parser.o )
[20 of 37] Compiling Dyna.ParserHS.OneshotDriver ( src/Dyna/ParserHS/OneshotDriver.hs, dist/build/dyna/dyna-tmp/Dyna/ParserHS/OneshotDriver.o )
[21 of 37] Compiling Dyna.Analysis.Mode.Unification ( src/Dyna/Analysis/Mode/Unification.hs, dist/build/dyna/dyna-tmp/Dyna/Analysis/Mode/Unification.o )
[22 of 37] Compiling Dyna.Analysis.Mode.Det ( src/Dyna/Analysis/Mode/Det.hs, dist/build/dyna/dyna-tmp/Dyna/Analysis/Mode/Det.o )
[23 of 37] Compiling Dyna.Analysis.Mode.Mode ( src/Dyna/Analysis/Mode/Mode.hs, dist/build/dyna/dyna-tmp/Dyna/Analysis/Mode/Mode.o )
[24 of 37] Compiling Dyna.Analysis.Mode.Execution.NamedInst ( src/Dyna/Analysis/Mode/Execution/NamedInst.hs, dist/build/dyna/dyna-tmp/Dyna/Analysis/Mode/Execution/NamedInst.o )

src/Dyna/Analysis/Mode/Execution/NamedInst.hs:257:37:
    Couldn't match type ‘b’ with ‘forall i_. InstF f1 i_’
      ‘b’ is a rigid type variable bound by
          the inferred type of
          go :: (() -> i -> b -> m i'')
                -> (() -> (forall i_. InstF f1 i_) -> i' -> m i'')
                -> (() -> i -> i' -> m i'')
                -> ()
                -> InstF f1 i
                -> InstF f1 i'
                -> m (InstF f1 i'')
          at src/Dyna/Analysis/Mode/Execution/NamedInst.hs:257:3
    Expected type: (forall i_. InstF f1 i_) -> i -> m i''
      Actual type: b -> i -> m i''
    Relevant bindings include
      lsmr :: () -> (forall i_. InstF f1 i_) -> i' -> m i''
        (bound at src/Dyna/Analysis/Mode/Execution/NamedInst.hs:257:11)
      lsml :: () -> i -> b -> m i''
        (bound at src/Dyna/Analysis/Mode/Execution/NamedInst.hs:257:6)
      go :: (() -> i -> b -> m i'')
            -> (() -> (forall i_. InstF f1 i_) -> i' -> m i'')
            -> (() -> i -> i' -> m i'')
            -> ()
            -> InstF f1 i
            -> InstF f1 i'
            -> m (InstF f1 i'')
        (bound at src/Dyna/Analysis/Mode/Execution/NamedInst.hs:257:3)
    In the first argument of ‘iSubGLB_’, namely ‘(flip (lsml ()))’
    In the expression: iSubGLB_ (flip (lsml ())) (lsmr ()) (merge ())
make: *** [build] Error 1

There were also some issues with trifecta installed from make, it had to be installed manually.

skylogic004 commented 9 years ago

I also had to install trifecta manually - but I haven't gotten make to work yet and I'm getting a different error than yours.

nwf commented 9 years ago

Hm. Sorry, you've caught the project in a pretty sad state right now; I've been trying to revamp some of the theory here for... entirely too long.

In any case, please let me know if f75282a4 helps and thanks for trying Dyna!

pyetras commented 9 years ago

Looks like f75282a helped with NamedInst.hs, although to get it to compile the whole thing I also had to

diff --git i/src/Dyna/Backend/NoBackend.hs w/src/Dyna/Backend/NoBackend.hs
index 6fa7a65..3bcfa62 100644
--- i/src/Dyna/Backend/NoBackend.hs
+++ w/src/Dyna/Backend/NoBackend.hs
@@ -11,6 +11,7 @@

 {-# LANGUAGE OverloadedStrings #-}
 {-# LANGUAGE Rank2Types #-}
+{-# LANGUAGE ImpredicativeTypes #-}
 module Dyna.Backend.NoBackend (noBackend, primPossible) where

 import           Control.Lens

(I'd submit a PR, but I honestly have no idea what it does :tongue:). Seems to work and pass some of the tests now. You've got a really clever language design here, thanks for opensourcing it.