Package: c2hs
Version: 0.16.3-2
Severity: important
Tags: upstream patch
c2hs uses shown Language.C data structures as an intermediate
representation (the .chi files), and has its own code for parsing
them. It seems that Language.C has changed its Show instance for
lexemes, and c2hs can no longer parse its own .chi files.
The symptom for me is that "cabal build" fails with the following
error message:
c2hs: Prelude.read: no parse
Patch attached.
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 3.1.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages c2hs depends on:
ii libc6 2.13-23
ii libffi5 3.0.10-3
ii libgmp10 2:5.0.2+dfsg-2
c2hs recommends no packages.
c2hs suggests no packages.
-- no debconf information
diff -ur c2hs-0.16.3/src/C2HS/Gen/Monad.hs c2hs-0.16.3.blegh/src/C2HS/Gen/Monad.hs
--- c2hs-0.16.3/src/C2HS/Gen/Monad.hs 2011-03-24 09:04:59.000000000 -0400
+++ c2hs-0.16.3.blegh/src/C2HS/Gen/Monad.hs 2011-12-10 11:13:54.000000000 -0500
@@ -212,6 +212,11 @@
-}
-- super kludgy (depends on Show instance of Ident)
instance Read Ident where
+ readsPrec _ ('"':lexeme) = let (ideChars, rest) = span (/= '"') lexeme
+ in
+ if null ideChars
+ then []
+ else [(internalIdent ideChars, tail rest)]
readsPrec _ ('`':lexeme) = let (ideChars, rest) = span (/= '\'') lexeme
in
if null ideChars