can't access struct field with name 'type'

A bit of an irritation I've run into is that one cannot say: valueType <- {# get GConfValue.type #} value You see, GConfValue is a C struct like so: struct GConfValue { GConfValueType type; ... }; where GConfValueType is a C enum. The c2hs tutorial seemed to indicate that you could do this http://www.cse.unsw.edu.au/~chak/haskell/c2hs/docu/c2hs.html#toc3.8 (see the example) however c2hs (version 0.10.17 & 0.12.0) complains: GConfValue.chs:156: (column 36) [ERROR]
Syntax error! The phrase `type' is not allowed here.
Presumably 'type' is a reserved token because 'type' is one of the c2hs directives. Would it be terribly difficult to make the directive names not special in cid contexts? Duncan

On Mon, 2004-04-19 at 14:21, Duncan Coutts wrote:
Presumably 'type' is a reserved token because 'type' is one of the c2hs directives. Would it be terribly difficult to make the directive names not special in cid contexts?
Yes, that's what is happening and I agree that it is a nuisance. It's on my TODO list for c2hs, but I haven't had much time to work on it recently. Cheers, Manuel
participants (2)
-
Duncan Coutts
-
Manuel M T Chakravarty