
Hello, I was trying to add a primitive function for which I modified Prelude.hs, Prelude.c and Primitive.hs. I rebuilt the prelude using 'yhc -c - redefine -prelude' and then did an scons, but I got the following error:
scons: Reading SConscript files ... Building version 0.7.0-20070215041026-custom. Checking for architecture... x86 Checking for operating system... linux2 Adding '-g3' to CCFLAGS. Checking for Subversion binary... "svn" Checking for Subversion version... Found version 1.4.0. Checking for GHC binary... "ghc" Checking for GHC version 6.4.1 or later... Found version 6.6. Checking for C header file gmp.h... yes Checking for mpz_t integ; mpz_init (integ) in C library gmp... yes Checking for libgmp version... 4.2.1 Bootstrapping... Done. scons: done reading SConscript files. scons: Building targets ... YHC_build(["src/packages/yhc-base-1.0/Foreign/Word.hbc"], ["src/packages/yhc-base-1.0/Foreign/Word.hs"]) inst/bin/yhc -core -cpp -c src/packages/yhc-base-1.0/Foreign/Word.hs Compiling Foreign.Word ( src/packages/yhc-base-1.0/Foreign/Word.hs ) ***instanceI(2) InfoUsed (Id 154) [(Type class,Integral,"oitaR.ataD",1041:16-1041:23)]
yhc: The class Integral has no instance for the type Prelude.Integer. Possible sources for the problem are: 102:713 When type checking declarations at: 102:686-102:715
scons: *** [src/packages/yhc-base-1.0/Foreign/Word.hbc] Error 1 scons: building terminated because of errors. kart@enlightenment:~/yhc>
I undid all the changes I made, and I still get this error. I did not change anything related to Integral or Integer AFAIK and I didn't even open the Word.hs file, and the Prelude still has the instance declaration (instance Integral Integer where...). How do I resolve this error? I don't want to do an scons fullclean because I'm working on a modified version of yhc. I haven't come across this error before that I remember, and I was able to build and pass the unit tests with no problem till this happened. Thanks for your help. -- Blogs: http://kartik-log.blogspot.com, http://randomkart.blogspot.com

Hi
I was trying to add a primitive function for which I modified Prelude.hs, Prelude.c and Primitive.hs. I rebuilt the prelude using 'yhc -c - redefine -prelude' and then did an scons, but I got the following error:
Recently the flag format changed, you must use two --'s for long options yhc -c --redefine --prelude Thanks Neil
scons: Reading SConscript files ... Building version 0.7.0-20070215041026-custom. Checking for architecture... x86 Checking for operating system... linux2 Adding '-g3' to CCFLAGS. Checking for Subversion binary... "svn" Checking for Subversion version... Found version 1.4.0. Checking for GHC binary... "ghc" Checking for GHC version 6.4.1 or later... Found version 6.6. Checking for C header file gmp.h... yes Checking for mpz_t integ; mpz_init (integ) in C library gmp... yes Checking for libgmp version... 4.2.1 Bootstrapping... Done. scons: done reading SConscript files. scons: Building targets ... YHC_build(["src/packages/yhc-base-1.0/Foreign/Word.hbc"], ["src/packages/yhc-base-1.0/Foreign/Word.hs"]) inst/bin/yhc -core -cpp -c src/packages/yhc-base-1.0/Foreign/Word.hs Compiling Foreign.Word ( src/packages/yhc-base-1.0/Foreign/Word.hs ) ***instanceI(2) InfoUsed (Id 154) [(Type class,Integral,"oitaR.ataD",1041:16-1041:23)]
yhc: The class Integral has no instance for the type Prelude.Integer. Possible sources for the problem are: 102:713 When type checking declarations at: 102:686-102:715
scons: *** [src/packages/yhc-base-1.0/Foreign/Word.hbc] Error 1 scons: building terminated because of errors. kart@enlightenment:~/yhc>
I undid all the changes I made, and I still get this error. I did not change anything related to Integral or Integer AFAIK and I didn't even open the Word.hs file, and the Prelude still has the instance declaration (instance Integral Integer where...).
How do I resolve this error? I don't want to do an scons fullclean because I'm working on a modified version of yhc. I haven't come across this error before that I remember, and I was able to build and pass the unit tests with no problem till this happened. Thanks for your help.
-- Blogs: http://kartik-log.blogspot.com, http://randomkart.blogspot.com
_______________________________________________ Yhc mailing list Yhc@haskell.org http://www.haskell.org/mailman/listinfo/yhc

Neil Mitchell wrote:
Hi
I was trying to add a primitive function for which I modified Prelude.hs, Prelude.c and Primitive.hs. I rebuilt the prelude using 'yhc -c - redefine -prelude' and then did an scons, but I got the following error:
Recently the flag format changed, you must use two --'s for long options
yhc -c --redefine --prelude Actually, my version is a couple months old, and it builds with a single '-'. I tried with --, and everything is as before: the Prelude builds, but the main scons fails with the below error. How do I resolve that? Thanks.
scons: Reading SConscript files ... Building version 0.7.0-20070215041026-custom. Checking for architecture... x86 Checking for operating system... linux2 Adding '-g3' to CCFLAGS. Checking for Subversion binary... "svn" Checking for Subversion version... Found version 1.4.0. Checking for GHC binary... "ghc" Checking for GHC version 6.4.1 or later... Found version 6.6. Checking for C header file gmp.h... yes Checking for mpz_t integ; mpz_init (integ) in C library gmp... yes Checking for libgmp version... 4.2.1 Bootstrapping... Done. scons: done reading SConscript files. scons: Building targets ... YHC_build(["src/packages/yhc-base-1.0/Foreign/Word.hbc"], ["src/packages/yhc-base-1.0/Foreign/Word.hs"]) inst/bin/yhc -core -cpp -c src/packages/yhc-base-1.0/Foreign/Word.hs Compiling Foreign.Word ( src/packages/yhc-base-1.0/Foreign/Word.hs ) ***instanceI(2) InfoUsed (Id 154) [(Type class,Integral,"oitaR.ataD",1041:16-1041:23)]
yhc: The class Integral has no instance for the type Prelude.Integer. Possible sources for the problem are: 102:713 When type checking declarations at: 102:686-102:715
scons: *** [src/packages/yhc-base-1.0/Foreign/Word.hbc] Error 1 scons: building terminated because of errors. kart@enlightenment:~/yhc>
I undid all the changes I made, and I still get this error. I did not change anything related to Integral or Integer AFAIK and I didn't even open the Word.hs file, and the Prelude still has the instance declaration (instance Integral Integer where...).
How do I resolve this error? I don't want to do an scons fullclean because I'm working on a modified version of yhc. I haven't come across this error before that I remember, and I was able to build and pass the unit tests with no problem till this happened. Thanks for your help.
-- Blogs: http://kartik-log.blogspot.com, http://randomkart.blogspot.com
_______________________________________________ Yhc mailing list Yhc@haskell.org http://www.haskell.org/mailman/listinfo/yhc
-- Blogs: http://kartik-log.blogspot.com, http://randomkart.blogspot.com

Hi Kartik, Unfortunately adding things to the prelude is a little more tricky than other modules. Indeed if at all possible I would recommend adding it to another module instead (perhaps your own module). The problem is the compiler has a rather 'hacked' view of the Prelude (a carry-over from the nhc98 source code). This means that it doesn't quite generate quite the right .hi file for the Prelude. The problem you've most likely got is that you've generated a .hi file that is missing the Integral instance for Prelude.Integer. The best way to solve this is to take the old Prelude.hi and modify it by hand to add your new definitions. This is a little fiddly but the syntax should be fairly obvious by looking at other examples. Alternatively if you add your functions to some module other than the Prelude then you don't get any of these problems at all and it all works as expected. Hope that helps Tom

Hi Thomas, I was able to modify the prelude before and add functions implemented in Haskell, with no trouble. Only when I try to define a *primitive* function, and touch Prelude.c and Primitive.hs does the build break. I removed all my changes to Prelude.hs, and it still gives the same error. My guess is that changing Prelude.c or Primitive.hs caused scons to recompile Word.hs, and that breaks. How do I get the build to work? Thanks. Thomas Shackell wrote:
Hi Kartik,
Unfortunately adding things to the prelude is a little more tricky than other modules. Indeed if at all possible I would recommend adding it to another module instead (perhaps your own module).
The problem is the compiler has a rather 'hacked' view of the Prelude (a carry-over from the nhc98 source code). This means that it doesn't quite generate quite the right .hi file for the Prelude. The problem you've most likely got is that you've generated a .hi file that is missing the Integral instance for Prelude.Integer. The best way to solve this is to take the old Prelude.hi and modify it by hand to add your new definitions. This is a little fiddly but the syntax should be fairly obvious by looking at other examples.
Alternatively if you add your functions to some module other than the Prelude then you don't get any of these problems at all and it all works as expected.
Hope that helps
Tom
-- Blogs: http://kartik-log.blogspot.com, http://randomkart.blogspot.com
participants (3)
-
Kartik Vaddadi
-
Neil Mitchell
-
Thomas Shackell