[Haskell-beginners] question about fclabels - libnova port project

Michael Litchard michael at schmong.org
Thu Jul 15 23:28:57 EDT 2010


I'm porting libnova http://libnova.sourceforge.net/ to haskell, and
another question has arisen.

I'm starting with header files, ln_types.h to begin with. I'm turning
C structs into fclabels.


struct lnh_lnlat_posn
{
    struct ln_dms lng; /*!< longitude. Object longitude.*/
    struct ln_dms lat; /*!< latitude. Object latitude */
};

becomes


data LNH_lnlat_posn = LHN_lnlat_posn {
      _lng          :: LN_dms
     ,_lat          :: LN_dms
}

$(mkLabels [''LNH_lnlat_posn])

lng   :: LNH_lnlat_posn :-> LN_dms
lat   :: LNH_lnlat_posn :-> LN_dms


I have many, many structs to change. What would it take to write an
abstraction that encompassed all steps?

Michael


More information about the Beginners mailing list