Skip to content
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

GHC 8.0.2-9448e62: Couldn't match type ‘m’ with ‘StateT s m’ #2421

Closed
ilovezfs opened this issue Nov 8, 2016 · 2 comments
Closed
Milestone

Comments

@ilovezfs
Copy link
Contributor

ilovezfs commented Nov 8, 2016

purescript 0.10.2 build failure with GHC pre-8.0.2-9448e62 (ghc/ghc@9448e62).

Building purescript-0.10.2...
Preprocessing library purescript-0.10.2...
[  1 of 139] Compiling System.IO.UTF8   ( src/System/IO/UTF8.hs, dist/dist-sandbox-4bbb699a/build/System/IO/UTF8.o )
[  2 of 139] Compiling Paths_purescript ( dist/dist-sandbox-4bbb699a/build/autogen/Paths_purescript.hs, dist/dist-sandbox-4bbb699a/build/Paths_purescript.o )
[  3 of 139] Compiling Language.PureScript.Traversals ( src/Language/PureScript/Traversals.hs, dist/dist-sandbox-4bbb699a/build/Language/PureScript/Traversals.o )
[  4 of 139] Compiling Language.PureScript.Publish.Utils ( src/Language/PureScript/Publish/Utils.hs, dist/dist-sandbox-4bbb699a/build/Language/PureScript/Publish/Utils.o )
[  5 of 139] Compiling Language.PureScript.Publish.BoxesHelpers ( src/Language/PureScript/Publish/BoxesHelpers.hs, dist/dist-sandbox-4bbb699a/build/Language/PureScript/Publish/BoxesHelpers.o )
[  6 of 139] Compiling Language.PureScript.Parser.State ( src/Language/PureScript/Parser/State.hs, dist/dist-sandbox-4bbb699a/build/Language/PureScript/Parser/State.o )
[  7 of 139] Compiling Language.PureScript.Options ( src/Language/PureScript/Options.hs, dist/dist-sandbox-4bbb699a/build/Language/PureScript/Options.o )
[  8 of 139] Compiling Language.PureScript.Kinds ( src/Language/PureScript/Kinds.hs, dist/dist-sandbox-4bbb699a/build/Language/PureScript/Kinds.o )
[  9 of 139] Compiling Language.PureScript.Interactive.IO ( src/Language/PureScript/Interactive/IO.hs, dist/dist-sandbox-4bbb699a/build/Language/PureScript/Interactive/IO.o )
[ 10 of 139] Compiling Language.PureScript.Docs.Utils.MonoidExtras ( src/Language/PureScript/Docs/Utils/MonoidExtras.hs, dist/dist-sandbox-4bbb699a/build/Language/PureScript/Docs/Utils/MonoidExtras.o )
[ 11 of 139] Compiling Language.PureScript.Crash ( src/Language/PureScript/Crash.hs, dist/dist-sandbox-4bbb699a/build/Language/PureScript/Crash.o )
[ 12 of 139] Compiling Language.PureScript.Comments ( src/Language/PureScript/Comments.hs, dist/dist-sandbox-4bbb699a/build/Language/PureScript/Comments.o )
[ 13 of 139] Compiling Language.PureScript.Parser.Lexer ( src/Language/PureScript/Parser/Lexer.hs, dist/dist-sandbox-4bbb699a/build/Language/PureScript/Parser/Lexer.o )
[ 14 of 139] Compiling Language.PureScript.Bundle ( src/Language/PureScript/Bundle.hs, dist/dist-sandbox-4bbb699a/build/Language/PureScript/Bundle.o )

src/Language/PureScript/Bundle.hs:535:5: warning: [-Wincomplete-patterns]
    Pattern match(es) are non-exhaustive
    In an equation for ‘squash’: Patterns not matched: JSAnnotSpace

src/Language/PureScript/Bundle.hs:590:7: warning: [-Wincomplete-patterns]
    Pattern match(es) are non-exhaustive
    In an equation for ‘appendAnn’:
        Patterns not matched: _ JSAnnotSpace
[ 15 of 139] Compiling Language.PureScript.AST.SourcePos ( src/Language/PureScript/AST/SourcePos.hs, dist/dist-sandbox-4bbb699a/build/Language/PureScript/AST/SourcePos.o )
[ 16 of 139] Compiling Language.PureScript.AST.Operators ( src/Language/PureScript/AST/Operators.hs, dist/dist-sandbox-4bbb699a/build/Language/PureScript/AST/Operators.o )
[ 17 of 139] Compiling Language.PureScript.AST.Literals ( src/Language/PureScript/AST/Literals.hs, dist/dist-sandbox-4bbb699a/build/Language/PureScript/AST/Literals.o )
[ 18 of 139] Compiling Control.Monad.Supply ( src/Control/Monad/Supply.hs, dist/dist-sandbox-4bbb699a/build/Control/Monad/Supply.o )
[ 19 of 139] Compiling Control.Monad.Supply.Class ( src/Control/Monad/Supply/Class.hs, dist/dist-sandbox-4bbb699a/build/Control/Monad/Supply/Class.o )

src/Control/Monad/Supply/Class.hs:30:10: error:
    • Couldn't match type ‘m’ with ‘StateT s m’
      ‘m’ is a rigid type variable bound by
        the instance declaration at src/Control/Monad/Supply/Class.hs:30:10
      Expected type: StateT s m Integer
        Actual type: StateT s (StateT s m) Integer
    • In the expression:
        Control.Monad.Supply.Class.$dmfresh @StateT s m
      In an equation for ‘fresh’:
          fresh = Control.Monad.Supply.Class.$dmfresh @StateT s m
      In the instance declaration for ‘MonadSupply (StateT s m)’
    • Relevant bindings include
        fresh :: StateT s m Integer
          (bound at src/Control/Monad/Supply/Class.hs:30:10)

src/Control/Monad/Supply/Class.hs:30:10: error:
    • Couldn't match type ‘m’ with ‘StateT s m’
      ‘m’ is a rigid type variable bound by
        the instance declaration at src/Control/Monad/Supply/Class.hs:30:10
      Expected type: StateT s m Integer
        Actual type: StateT s (StateT s m) Integer
    • In the expression: Control.Monad.Supply.Class.$dmpeek @StateT s m
      In an equation for ‘peek’:
          peek = Control.Monad.Supply.Class.$dmpeek @StateT s m
      In the instance declaration for ‘MonadSupply (StateT s m)’
    • Relevant bindings include
        peek :: StateT s m Integer
          (bound at src/Control/Monad/Supply/Class.hs:30:10)

src/Control/Monad/Supply/Class.hs:31:10: error:
    • Couldn't match type ‘m’ with ‘WriterT w m’
      ‘m’ is a rigid type variable bound by
        the instance declaration at src/Control/Monad/Supply/Class.hs:31:10
      Expected type: WriterT w m Integer
        Actual type: WriterT w (WriterT w m) Integer
    • In the expression:
        Control.Monad.Supply.Class.$dmfresh @WriterT w m
      In an equation for ‘fresh’:
          fresh = Control.Monad.Supply.Class.$dmfresh @WriterT w m
      In the instance declaration for ‘MonadSupply (WriterT w m)’
    • Relevant bindings include
        fresh :: WriterT w m Integer
          (bound at src/Control/Monad/Supply/Class.hs:31:10)

src/Control/Monad/Supply/Class.hs:31:10: error:
    • Couldn't match type ‘m’ with ‘WriterT w m’
      ‘m’ is a rigid type variable bound by
        the instance declaration at src/Control/Monad/Supply/Class.hs:31:10
      Expected type: WriterT w m Integer
        Actual type: WriterT w (WriterT w m) Integer
    • In the expression:
        Control.Monad.Supply.Class.$dmpeek @WriterT w m
      In an equation for ‘peek’:
          peek = Control.Monad.Supply.Class.$dmpeek @WriterT w m
      In the instance declaration for ‘MonadSupply (WriterT w m)’
    • Relevant bindings include
        peek :: WriterT w m Integer
          (bound at src/Control/Monad/Supply/Class.hs:31:10)
cabal: Leaving directory '.'
cabal: Error: some packages failed to install:
purescript-0.10.2 failed during the building phase. The exception was:
ExitFailure 1

Full build log: https://bot.brew.sh/job/Homebrew%20Core/10983/version=any_sierra/consoleText

(link will eventually die, so duplicated here: https://gist.githubusercontent.com/ilovezfs/fb1c282b2a123e23d480882e74f74db4/raw/24f75f77fa0922d593ec58df7a6787314a9c54e8/gistfile1.txt)

@ilovezfs
Copy link
Contributor Author

ilovezfs commented Nov 8, 2016

Note that this is a bug in purescript, not GHC, and it's basically the same problem as kazu-yamamoto/logger#106 was, which was fixed in kazu-yamamoto/logger#108. See the discussion in https://ghc.haskell.org/trac/ghc/ticket/12784 for additional information.

@ilovezfs
Copy link
Contributor Author

ilovezfs commented Nov 8, 2016

The release notes for 8.0.2 will mention the situation: https://phabricator.haskell.org/D2682 since downstream projects will be expected to correct their types.

rwbarton has identified the problematic bits in purescript here: https://ghc.haskell.org/trac/ghc/ticket/12784#comment:11

And the relevant code (excerpted from ​https://github.com/purescript/purescript/blob/master/src/Control/Monad/Supply/Class.hs):

class Monad m => MonadSupply m where
  fresh :: m Integer
  peek :: m Integer
  default fresh :: MonadTrans t => t m Integer
  fresh = lift fresh
  default peek :: MonadTrans t => t m Integer
  peek = lift peek

instance MonadSupply m => MonadSupply (StateT s m)
instance (Monoid w, MonadSupply m) => MonadSupply (WriterT w m)

@paf31 paf31 added the type: bug label Nov 9, 2016
@paf31 paf31 added this to the 1.0 milestone Nov 9, 2016
paf31 pushed a commit that referenced this issue Nov 9, 2016
* Fix GHC 8.0.2 build (and fix #2421)

* Update CONTRIBUTORS.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants