[C2hs] can't access struct field with name 'type'

Duncan Coutts duncan.coutts at worcester.oxford.ac.uk
Mon Apr 19 06:21:07 EDT 2004

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
(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?


More information about the C2hs mailing list