Help needed with a compiling error

View: New views
2 Messages — Rating Filter:   Alert me  

Help needed with a compiling error

by HP Wei :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


compiler: nhc98-1.18 on Sun sparc machine
code-to-compile: the  one near the end of this web page:
           http://cgi.cse.unsw.edu.au/~dons/blog/2006/12/18

[ I cut-and-paste it into a file called cat.hs ]

command invoked:
   nhc98 -o cat cat.hs
   nhc98 -package base -o cat cat.hs

   [ both give the same result. ]

The last line of total 4 lines of output looks like:

Fail: superclassesI InfoUsedClass 52 [(Type class, Text.Printf.PrintfArg,
                                      "ftnirP.txeT", 52:11-52:19)] ...

Could someone tell me what I should do to fix the problem ?

Note: the same code can be compiled with ghc6.8.2
      [ but I have to repalce withFile with withFile1 in cat.hs ].
     
      I am using nhc98 so that the binary-code generated
      can be small.

Thanks
HP



_______________________________________________
Nhc-users mailing list
Nhc-users@...
http://www.haskell.org/mailman/listinfo/nhc-users

Re: Help needed with a compiling error

by Malcolm Wallace :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

HP Wei <hp@...> wrote:

> Fail: superclassesI InfoUsedClass 52 [(Type class, Text.Printf.PrintfArg,
>                                       "ftnirP.txeT", 52:11-52:19)] ...

nhc98 is confused about whether the classes defined in Test.Printf are
necessary or not.  There is a workaround: explicit imports.  Replace

    import Text.Printf

with

    import Text.Printf (IsChar(),PrintfArg(),printf)

and everything will work OK.

Regards,
    Malcolm
_______________________________________________
Nhc-users mailing list
Nhc-users@...
http://www.haskell.org/mailman/listinfo/nhc-users