example/DumpAst.hs not loading

Joe M joe7mail at gmail.com
Tue Jun 21 20:52:54 BST 2011


Hello,

The DumpAst.hs does not seem to be working. Is there a different file
that works.
I am trying to understand how to use the language-c library to parse a
c file into haskell.

Below is the error that I notice with DumpAst.hs

--(~/.cabal/packages/hackage.haskell.org/language-c/language-c/examples)------------(pts/0 at backup)--
ghci -Wall DumpAst.hs
GHCi, version 7.0.4: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
(0.02 secs, 0 bytes)
[1 of 1] Compiling Main             ( DumpAst.hs, interpreted )

DumpAst.hs:23:54:
    No instance for (Show (f0 ShowPlaceholder))
      arising from a use of `show'
    Possible fix:
      add an instance declaration for (Show (f0 ShowPlaceholder))
    In the expression: show
    In the second argument of `($)', namely
      `show $ fmap (const ShowPlaceholder) ast'
    In the second argument of `($)', namely
      `decorate $ show $ fmap (const ShowPlaceholder) ast'

DumpAst.hs:23:90:
    Couldn't match expected type `f0 a0'
                with actual type `Language.C.Syntax.AST.CTranslUnit'
    In the second argument of `fmap', namely `ast'
    In the second argument of `($)', namely
      `fmap (const ShowPlaceholder) ast'
    In the second argument of `($)', namely
      `show $ fmap (const ShowPlaceholder) ast'
Failed, modules loaded: none.
(0.29 secs, 41161088 bytes)
Prelude>

Thanks
Joe



More information about the Language-c mailing list