haskell - Parsec3 blocked by parsec, what ever I do -
using cabal file looking (the relevant library part):
build-depends: base >=4.8 && < 4.9, filepath >=1.4 && <1.5, time >=1.5 && <1.6, bytestring >=0.10 && <0.11, unix >=2.7 && <2.8, cryptohash >=0.11 && <0.12, process >=1.2 && <1.3, transformers >= 0.4 && < 0.5, text >= 1.2 && <= 1.3, base16-bytestring >= 0.1.1 && < 1.1.2, utf8-string >= 1 && < 1.1, directory >=1.2 && <1.3, regex-base >= 0.9 && < 1.0, regex-pcre >= 0.94 && < 0.95, regex-base >= 0.93 && < 0.94, direct-sqlite >=2.3 && <2.4, text >=1.2 && <1.3, filemanip >=0.3 && < 0.4, parsec3-numbers >=0.1 && < 0.2, parsec3 >=1.0 && <1.1
i when doing cabal build
:
... couldn't match expected type ‘parsect text () data.functor.identity.identity double’ actual type ‘parsec-3.1.9:text.parsec.prim.parsect s0 u0 m0 double’ nb: ‘parsect’ defined in ‘text.parsec.prim’ in package ‘parsec3-1.0.1.8’ ‘parsec-3.1.9:text.parsec.prim.parsect’ defined in ‘text.parsec.prim’ in package ‘parsec-3.1.9’ in stmt of 'do' block: time <- floating
what trying use floating2
parser in parsec3-numbers
package, somehow interference of parsec-3.1.9. same problem if load failing file ghci , :set -hide-package parsec
or :set -hide-package parsec-numbers
set.
how make sure parsec3 parsers? imports using in file are:
import text.parsec.text import text.parsec import text.parsec.number import qualified data.list dl import qualified data.text.io tio import database.sqlite3 import data.text
so should work. need text parsing capabilities of parsec3, why went this.
fredrik
edit:
ok, reducing problem minimal form highlights real issue. using code:
import text.parsec.text import text.parsec import text.parsec.number num:: bool -> parser double num = floating2
and procedure evaluating not depend on specific build tool used
> cd ~ # move outside of cabal package > ghci -hide-package parsec # parsec should not pulled in ghci, version 7.10.3: http://www.haskell.org/ghc/ :? prelude> :l test.hs [1 of 1] compiling main ( test.hs, interpreted ) test.hs:6:7: couldn't match type ‘parsec-3.1.9:text.parsec.prim.parsect s0 u0 m0 double’ ‘parsect data.text.internal.text () data.functor.identity.identity double’ nb: ‘parsec-3.1.9:text.parsec.prim.parsect’ defined in ‘text.parsec.prim’ in package ‘parsec-3.1.9’ ‘parsect’ defined in ‘text.parsec.prim’ in package ‘parsec3-1.0.1.8’ expected type: parser -> parser double actual type: bool -> parsec-3.1.9:text.parsec.prim.parsect s0 u0 m0 double in expression: floating2 in equation ‘num’: num = floating2 failed, modules loaded: none.
as can see, parsec-3.1.9
still pulled in, , 'blocking' parsec3
definitions.
just provide clean case here, parsec-numbers
package out there, , not creating problem in case:
> ghci -hide-package parsec-numbers ghci, version 7.10.3: http://www.haskell.org/ghc/ :? <command line>: cannot satisfy -hide-package parsec-numbers (use -v more information)
in .cabal file parsec3-numbers
there is:
flag parsec3 description: use parsec3 default: false library exposed-modules: text.parsec.number if flag(parsec3) build-depends: parsec3 else build-depends: parsec
so bet want build parsec3-numbers
-f parsec3
option.