ekmett / trifecta

Parser combinators with highlighting, slicing, layout, literate comments, Clang-style diagnostics and the kitchen sink
http://ekmett.github.com/trifecta/
Other
298 stars 49 forks source link

No instance for (Monoid a) arising from a use of `mappend' #15

Closed markwright closed 11 years ago

markwright commented 11 years ago

trifecta-1.1 builds fine with ghc 7.6.3 on Gentoo amd64. I had loosened the the blaze-html and fingetree deps. Bumping it to 1.2, I also loosened the deps so I could compile it. For me, the compile fails, so just wanted to report that, thanks.

argus trifecta # diff -wc trifecta-1.1.ebuild trifecta-1.2.ebuild 
*** trifecta-1.1.ebuild Sat Sep 28 15:16:56 2013
--- trifecta-1.2.ebuild Tue Oct  1 20:56:32 2013
***************
*** 21,32 ****
  RDEPEND=">=dev-haskell/ansi-terminal-0.6:=[profile?] <dev-haskell/ansi-terminal-0.7:=[profile?]
    >=dev-haskell/ansi-wl-pprint-0.6.6:=[profile?] <dev-haskell/ansi-wl-pprint-0.7:=[profile?]
    >=dev-haskell/blaze-builder-0.3.0.1:=[profile?] <dev-haskell/blaze-builder-0.4:=[profile?]
!   >=dev-haskell/blaze-html-0.5:=[profile?] <dev-haskell/blaze-html-0.7:=[profile?]
    >=dev-haskell/blaze-markup-0.5:=[profile?] <dev-haskell/blaze-markup-0.6:=[profile?]
    >=dev-haskell/charset-0.3.2.1:=[profile?] <dev-haskell/charset-1:=[profile?]
    >=dev-haskell/comonad-3:=[profile?] <dev-haskell/comonad-4:=[profile?]
    >=dev-haskell/deepseq-1.2.0.1:=[profile?] <dev-haskell/deepseq-1.4:=[profile?]
!   >=dev-haskell/fingertree-0.0.1:=[profile?] <dev-haskell/fingertree-0.2:=[profile?]
    >=dev-haskell/hashable-1.2:=[profile?] <dev-haskell/hashable-1.3:=[profile?]
    >=dev-haskell/lens-3.8.2:=[profile?] <dev-haskell/lens-4:=[profile?]
    >=dev-haskell/mtl-2.0.1:=[profile?] <dev-haskell/mtl-2.2:=[profile?]
--- 21,32 ----
  RDEPEND=">=dev-haskell/ansi-terminal-0.6:=[profile?] <dev-haskell/ansi-terminal-0.7:=[profile?]
    >=dev-haskell/ansi-wl-pprint-0.6.6:=[profile?] <dev-haskell/ansi-wl-pprint-0.7:=[profile?]
    >=dev-haskell/blaze-builder-0.3.0.1:=[profile?] <dev-haskell/blaze-builder-0.4:=[profile?]
!   >=dev-haskell/blaze-html-0.5:=[profile?] <dev-haskell/blaze-html-0.6:=[profile?]
    >=dev-haskell/blaze-markup-0.5:=[profile?] <dev-haskell/blaze-markup-0.6:=[profile?]
    >=dev-haskell/charset-0.3.2.1:=[profile?] <dev-haskell/charset-1:=[profile?]
    >=dev-haskell/comonad-3:=[profile?] <dev-haskell/comonad-4:=[profile?]
    >=dev-haskell/deepseq-1.2.0.1:=[profile?] <dev-haskell/deepseq-1.4:=[profile?]
!   >=dev-haskell/fingertree-0.0.1:=[profile?] <dev-haskell/fingertree-0.1:=[profile?]
    >=dev-haskell/hashable-1.2:=[profile?] <dev-haskell/hashable-1.3:=[profile?]
    >=dev-haskell/lens-3.8.2:=[profile?] <dev-haskell/lens-4:=[profile?]
    >=dev-haskell/mtl-2.0.1:=[profile?] <dev-haskell/mtl-2.2:=[profile?]
***************
*** 42,50 ****
    >=dev-haskell/cabal-1.10
    test? ( >=dev-haskell/doctest-0.9.1 )
  "
- 
- src_prepare() {
-   cabal_chdeps \
-       'blaze-html           >= 0.5     && < 0.6' 'blaze-html           >= 0.5     && < 0.7' \
-       'fingertree           >= 0.0.1   && < 0.1' 'fingertree           >= 0.0.1   && < 0.2'
- }
--- 42,44 ----
argus trifecta # mv trifecta-1.1.ebuild trifecta-1.2.ebuild 
argus trifecta # repoman fix

RepoMan scours the neighborhood...
>>> Creating Manifest for /var/lib/layman/haskell/dev-haskell/trifecta
  ebuild.notadded               1
   dev-haskell/trifecta/trifecta-1.2.ebuild

Note: use --include-dev (-d) to check dependencies for 'dev' profiles

RepoMan sez: "You're only giving me a partial QA payment?
              I'll take it this time, but I'm not happy."
argus trifecta # emerge -av dev-haskell/trifecta

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild     U ~] dev-haskell/trifecta-1.2:0/1.2::gentoo-haskell [1.1:0/1.1::gentoo-haskell] USE="doc hoogle hscolour profile {test}" 0 kB

Total: 1 package (1 upgrade), Size of downloads: 0 kB

Would you like to merge these packages? [Yes/No] y
>>> Verifying ebuild manifests
>>> Emerging (1 of 1) dev-haskell/trifecta-1.2 from gentoo-haskell
>>> Failed to emerge dev-haskell/trifecta-1.2, Log file:
>>>  '/var/tmp/portage/dev-haskell/trifecta-1.2/temp/build.log'
>>> Jobs: 0 of 1 complete, 1 failed                 Load avg: 0.66, 0.33, 0.17
 * Package:    dev-haskell/trifecta-1.2
 * Repository: gentoo-haskell
 * Maintainer: haskell@gentoo.org
 * USE:        amd64 doc elibc_glibc hoogle hscolour kernel_linux profile test userland_GNU
 * FEATURES:   compressdebug installsources preserve-libs sandbox splitdebug test userpriv usersandbox
>>> Unpacking source...
>>> Unpacking trifecta-1.2.tar.gz to /var/tmp/portage/dev-haskell/trifecta-1.2/work
>>> Source unpacked in /var/tmp/portage/dev-haskell/trifecta-1.2/work
>>> Preparing source in /var/tmp/portage/dev-haskell/trifecta-1.2/work/trifecta-1.2 ...
 * CHDEP: 'blaze-html           >= 0.5     && < 0.6' -> 'blaze-html           >= 0.5     && < 0.7'
 * CHDEP: 'fingertree           >= 0.0.1   && < 0.1' -> 'fingertree           >= 0.0.1   && < 0.2'
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/dev-haskell/trifecta-1.2/work/trifecta-1.2 ...
 * Using cabal-1.16.0.3.
 * Prepending /usr/lib64/ghc-7.6.3 to LD_LIBRARY_PATH
/usr/bin/ghc -package Cabal-1.16.0.3 --make /var/tmp/portage/dev-haskell/trifecta-1.2/work/trifecta-1.2/Setup.lhs -dynamic -o setup
[1 of 1] Compiling Main             ( /var/tmp/portage/dev-haskell/trifecta-1.2/work/trifecta-1.2/Setup.lhs, /var/tmp/portage/dev-haskell/trifecta-1.2/work/trifecta-1.2/Setup.o )
Linking setup ...
./setup configure --ghc --prefix=/usr --with-compiler=/usr/bin/ghc --with-hc-pkg=/usr/bin/ghc-pkg --prefix=/usr --libdir=/usr/lib64 --libsubdir=trifecta-1.2/ghc-7.6.3 --datadir=/usr/share/ --datasubdir=trifecta-1.2/ghc-7.6.3 --with-haddock=/usr/bin/haddock --enable-library-profiling --enable-tests --ghc-option=-optl-Wl,--hash-style=gnu --ghc-option=-optl-Wl,-O1 --ghc-option=-optl-Wl,--as-needed --disable-executable-stripping --docdir=/usr/share/doc/trifecta-1.2 --verbose
Configuring trifecta-1.2...
Dependency ansi-terminal ==0.6.*: using ansi-terminal-0.6
Dependency ansi-wl-pprint >=0.6.6 && <0.7: using ansi-wl-pprint-0.6.6
Dependency array >=0.3.0.2 && <0.5: using array-0.4.0.1
Dependency base >=4.4 && <5: using base-4.6.0.1
Dependency blaze-builder >=0.3.0.1 && <0.4: using blaze-builder-0.3.1.1
Dependency blaze-html >=0.5 && <0.7: using blaze-html-0.6.1.1
Dependency blaze-markup ==0.5.*: using blaze-markup-0.5.1.5
Dependency bytestring >=0.9.1 && <0.11: using bytestring-0.10.0.2
Dependency charset >=0.3.2.1 && <1: using charset-0.3.5
Dependency comonad ==3.*: using comonad-3.1
Dependency containers >=0.3 && <0.6: using containers-0.5.0.0
Dependency deepseq >=1.2.0.1 && <1.4: using deepseq-1.3.0.1
Dependency directory >=1.0: using directory-1.2.0.1
Dependency doctest >=0.9.1: using doctest-0.9.8
Dependency filepath -any: using filepath-1.3.0.1
Dependency fingertree >=0.0.1 && <0.2: using fingertree-0.1.0.0
Dependency ghc-prim -any: using ghc-prim-0.3.0.0
Dependency hashable ==1.2.*: using hashable-1.2.1.0
Dependency lens >=3.8.2 && <4: using lens-3.9.1
Dependency mtl >=2.0.1 && <2.2: using mtl-2.1.2
Dependency parsers >=0.5 && <1: using parsers-0.9
Dependency reducers ==3.*: using reducers-3.0.2
Dependency semigroups >=0.8.3.1 && <1: using semigroups-0.11
Dependency transformers >=0.2 && <0.4: using transformers-0.3.0.0
Dependency unordered-containers >=0.2.1 && <0.3: using
unordered-containers-0.2.3.3
Dependency utf8-string >=0.3.6 && <0.4: using utf8-string-0.3.7
Using Cabal-1.16.0.3 compiled by ghc-7.6
Using compiler: ghc-7.6.3
Using install prefix: /usr
Binaries installed in: /usr/bin
Libraries installed in: /usr/lib64/trifecta-1.2/ghc-7.6.3
Private binaries installed in: /usr/libexec
Data files installed in: /usr/share/trifecta-1.2/ghc-7.6.3
Documentation installed in: /usr/share/doc/trifecta-1.2
Using alex version 3.1.0 found on system at: /usr/bin/alex
Using ar found on system at: /usr/bin/ar
Using c2hs version 0.16.5 found on system at: /usr/bin/c2hs
Using cpphs version 1.17.1 found on system at: /usr/bin/cpphs
No ffihugs found
Using gcc version 4.7.3 found on system at: /usr/bin/gcc
Using ghc version 7.6.3 given by user at: /usr/bin/ghc
Using ghc-pkg version 7.6.3 given by user at: /usr/bin/ghc-pkg
No greencard found
Using haddock version 2.13.2.1 given by user at: /usr/bin/haddock
Using happy version 1.19.0 found on system at: /usr/bin/happy
No hmake found
Using hpc version 0.6 found on system at: /usr/bin/hpc
Using hsc2hs version 0.67 found on system at: /usr/bin/hsc2hs
Using hscolour version 1.20 found on system at: /usr/bin/HsColour
No hugs found
No jhc found
Using ld found on system at: /usr/bin/ld
No lhc found
No lhc-pkg found
No nhc98 found
Using pkg-config version 0.28 found on system at: /usr/bin/pkg-config
Using ranlib found on system at: /usr/bin/ranlib
Using strip found on system at: /usr/bin/strip
Using tar found on system at: /bin/tar
No uhc found
>>> Source configured.
>>> Compiling source in /var/tmp/portage/dev-haskell/trifecta-1.2/work/trifecta-1.2 ...
./setup build
Building trifecta-1.2...
Preprocessing library trifecta-1.2...
[ 1 of 13] Compiling Text.Trifecta.Util.Array ( src/Text/Trifecta/Util/Array.hs, dist/build/Text/Trifecta/Util/Array.o )
[ 2 of 13] Compiling Text.Trifecta.Util.Combinators ( src/Text/Trifecta/Util/Combinators.hs, dist/build/Text/Trifecta/Util/Combinators.o )
[ 3 of 13] Compiling Text.Trifecta.Util.IntervalMap ( src/Text/Trifecta/Util/IntervalMap.hs, dist/build/Text/Trifecta/Util/IntervalMap.o )
[ 4 of 13] Compiling Text.Trifecta.Instances ( src/Text/Trifecta/Instances.hs, dist/build/Text/Trifecta/Instances.o )
[ 5 of 13] Compiling Text.Trifecta.Delta ( src/Text/Trifecta/Delta.hs, dist/build/Text/Trifecta/Delta.o )
[ 6 of 13] Compiling Text.Trifecta.Rope ( src/Text/Trifecta/Rope.hs, dist/build/Text/Trifecta/Rope.o )
[ 7 of 13] Compiling Text.Trifecta.Util.It ( src/Text/Trifecta/Util/It.hs, dist/build/Text/Trifecta/Util/It.o )
[ 8 of 13] Compiling Text.Trifecta.Highlight ( src/Text/Trifecta/Highlight.hs, dist/build/Text/Trifecta/Highlight.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.4.0.1 ... linking ... done.
Loading package deepseq-1.3.0.1 ... linking ... done.
Loading package bytestring-0.10.0.2 ... linking ... done.
Loading package utf8-string-0.3.7 ... linking ... done.
Loading package containers-0.5.0.0 ... linking ... done.
Loading package text-0.11.3.1 ... linking ... done.
Loading package hashable-1.2.1.0 ... linking ... done.
Loading package nats-0.1.2 ... linking ... done.
Loading package unordered-containers-0.2.3.3 ... linking ... done.
Loading package semigroups-0.11 ... linking ... done.
Loading package tagged-0.7 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package comonad-3.1 ... linking ... done.
Loading package fingertree-0.1.0.0 ... linking ... done.
Loading package transformers-compat-0.1.1.1 ... linking ... done.
Loading package contravariant-0.4.4 ... linking ... done.
Loading package distributive-0.3.1 ... linking ... done.
Loading package semigroupoids-3.1 ... linking ... done.
Loading package comonad-transformers-3.1 ... linking ... done.
Loading package mtl-2.1.2 ... linking ... done.
Loading package comonads-fd-3.0.3 ... linking ... done.
Loading package bifunctors-3.2.0.1 ... linking ... done.
Loading package profunctors-3.3.0.1 ... linking ... done.
Loading package free-3.4.2 ... linking ... done.
Loading package keys-3.0.3 ... linking ... done.
Loading package data-default-class-0.0.1 ... linking ... done.
Loading package data-default-instances-base-0.0.1 ... linking ... done.
Loading package data-default-instances-containers-0.0.1 ... linking ... done.
Loading package dlist-0.5 ... linking ... done.
Loading package data-default-instances-dlist-0.0.1 ... linking ... done.
Loading package old-locale-1.0.0.5 ... linking ... done.
Loading package data-default-instances-old-locale-0.0.1 ... linking ... done.
Loading package data-default-0.5.3 ... linking ... done.
Loading package stm-2.4.2 ... linking ... done.
Loading package pointed-3.1 ... linking ... done.
Loading package reducers-3.0.2 ... linking ... done.
Loading package charset-0.3.5 ... linking ... done.
Loading package parsers-0.9 ... linking ... done.
Loading package extensible-exceptions-0.1.1.4 ... linking ... done.
Loading package MonadCatchIO-transformers-0.3.0.0 ... linking ... done.
Loading package filepath-1.3.0.1 ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package generic-deriving-1.6.2 ... linking ... done.
Loading package parallel-3.2.0.3 ... linking ... done.
Loading package groupoids-3.0.1.1 ... linking ... done.
Loading package semigroupoid-extras-3.0.1 ... linking ... done.
Loading package profunctor-extras-3.3.3.1 ... linking ... done.
Loading package reflection-1.3.2 ... linking ... done.
Loading package split-0.2.2 ... linking ... done.
Loading package primitive-0.5.1.0 ... linking ... done.
Loading package vector-0.10.9.1 ... linking ... done.
Loading package void-0.6.1 ... linking ... done.
Loading package lens-3.9.1 ... linking ... done.
Loading package blaze-builder-0.3.1.1 ... linking ... done.
Loading package blaze-markup-0.5.1.5 ... linking ... done.
Loading package blaze-html-0.6.1.1 ... linking ... done.
Loading package time-1.4.0.1 ... linking ... done.
Loading package unix-2.6.0.1 ... linking ... done.
Loading package ansi-terminal-0.6 ... linking ... done.
Loading package ansi-wl-pprint-0.6.6 ... linking ... done.
[ 9 of 13] Compiling Text.Trifecta.Rendering ( src/Text/Trifecta/Rendering.hs, dist/build/Text/Trifecta/Rendering.o )
[10 of 13] Compiling Text.Trifecta.Combinators ( src/Text/Trifecta/Combinators.hs, dist/build/Text/Trifecta/Combinators.o )
[11 of 13] Compiling Text.Trifecta.Result ( src/Text/Trifecta/Result.hs, dist/build/Text/Trifecta/Result.o )
[12 of 13] Compiling Text.Trifecta.Parser ( src/Text/Trifecta/Parser.hs, dist/build/Text/Trifecta/Parser.o )

src/Text/Trifecta/Parser.hs:100:20:
    No instance for (Monoid a) arising from a use of `mappend'
    Possible fix:
      add (Monoid a) to the context of the instance declaration
    In the first argument of `liftA2', namely `mappend'
    In the expression: liftA2 mappend
    In an equation for `mappend': mappend = liftA2 mappend

src/Text/Trifecta/Parser.hs:102:17:
    No instance for (Monoid a) arising from a use of `mempty'
    Possible fix:
      add (Monoid a) to the context of the instance declaration
    In the first argument of `pure', namely `mempty'
    In the expression: pure mempty
    In an equation for `mempty': mempty = pure mempty
 * ERROR: dev-haskell/trifecta-1.2::gentoo-haskell failed (compile phase):
 *   setup build failed
 * 
 * Call stack:
 *     ebuild.sh, line   93:  Called src_compile
 *   environment, line 2977:  Called haskell-cabal_src_compile
 *   environment, line 2278:  Called cabal_src_compile
 *   environment, line  744:  Called cabal-build
 *   environment, line  515:  Called die
 * The specific snippet of code:
 *       ./setup "$@" || die "setup build failed"
 * 
 * If you need support, post the output of `emerge --info '=dev-haskell/trifecta-1.2::gentoo-haskell'`,
 * the complete build log and the output of `emerge -pqv '=dev-haskell/trifecta-1.2::gentoo-haskell'`.
 * The complete build log is located at '/var/tmp/portage/dev-haskell/trifecta-1.2/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-haskell/trifecta-1.2/temp/environment'.
 * Working directory: '/var/tmp/portage/dev-haskell/trifecta-1.2/work/trifecta-1.2'
 * S: '/var/tmp/portage/dev-haskell/trifecta-1.2/work/trifecta-1.2'

 * Messages for package dev-haskell/trifecta-1.2:

 * ERROR: dev-haskell/trifecta-1.2::gentoo-haskell failed (compile phase):
 *   setup build failed
 * 
 * Call stack:
 *     ebuild.sh, line   93:  Called src_compile
 *   environment, line 2977:  Called haskell-cabal_src_compile
 *   environment, line 2278:  Called cabal_src_compile
 *   environment, line  744:  Called cabal-build
 *   environment, line  515:  Called die
 * The specific snippet of code:
 *       ./setup "$@" || die "setup build failed"
 * 
 * If you need support, post the output of `emerge --info '=dev-haskell/trifecta-1.2::gentoo-haskell'`,
 * the complete build log and the output of `emerge -pqv '=dev-haskell/trifecta-1.2::gentoo-haskell'`.
 * The complete build log is located at '/var/tmp/portage/dev-haskell/trifecta-1.2/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-haskell/trifecta-1.2/temp/environment'.
 * Working directory: '/var/tmp/portage/dev-haskell/trifecta-1.2/work/trifecta-1.2'
 * S: '/var/tmp/portage/dev-haskell/trifecta-1.2/work/trifecta-1.2'
argus trifecta # 
blamario commented 11 years ago

Apart from this problem, the Monoid instance is not consistent with the Semigroup one. Here's a patch for both issues:

diff --git a/src/Text/Trifecta/Parser.hs b/src/Text/Trifecta/Parser.hs index 28386ca..0ed5033 100644 --- a/src/Text/Trifecta/Parser.hs +++ b/src/Text/Trifecta/Parser.hs @@ -92,11 +92,11 @@ instance Alternative Parser where {-# INLINE many #-} some p = (:) <$> p <*> Alternative.many p

-instance Semigroup (Parser a) where

-instance Monoid (Parser a) where +instance Monoid a => Monoid (Parser a) where mappend = liftA2 mappend {-# INLINE mappend #-} mempty = pure mempty

ekmett commented 11 years ago

I'll ship out a patch today.

ekmett commented 11 years ago

Stopped on my way into work and camped out on a bench to fix it. You should be all set. =)