
On Wed, 27 Jul 2005, John Goerzen wrote: ...
Right now, I'm using hsc2hs, and writing something like this:
#enum LDAPInt, , LDAP_PORT, LDAPS_PORT, LDAP_API_VERSION, LDAP_VENDOR_NAME, \ LDAP_OPT_API_INFO, LDAP_OPT_DESC, LDAP_OPT_DEREF, \ LDAP_OPT_SIZELIMIT, LDAP_OPT_TIMELIMIT, LDAP_OPT_REFERRALS, \ LDAP_OPT_RESTART, LDAP_OPT_PROTOCOL_VERSION, LDAP_OPT_SERVER_CONTROLS, \
That boils down to this:
ldapPort :: LDAPInt ldapPort = 389 ldapsPort :: LDAPInt ldapsPort = 636
So I still lack typechecking, and have to manually key in all the identifiers, but at least the system pulls their values and types in for me.
I wanted them to be enumerated types in Haskell where appropriate, and the only thing I could think of was data LDAPOpt = LDAP_OPT_X_TLS | LDAP_OPT_X_TLS_REQUIRE_CERT | LDAP_OPT_PROTOCOL_VERSION | LDAP_OPT_DEBUG_LEVEL fromLDAPOpt LDAP_OPT_X_TLS = (#const LDAP_OPT_X_TLS) fromLDAPOpt LDAP_OPT_X_TLS_REQUIRE_CERT = (#const LDAP_OPT_X_TLS_REQUIRE_CERT) fromLDAPOpt LDAP_OPT_PROTOCOL_VERSION = (#const LDAP_OPT_PROTOCOL_VERSION) fromLDAPOpt LDAP_OPT_DEBUG_LEVEL = (#const LDAP_OPT_DEBUG_LEVEL) etc. Donn Cave, donn@drizzle.com