 
 import Data.ByteString (ByteString)
 import Data.ByteString.Char8 (packCStringLen)
-import Data.Int (Int64)
+import Data.Int (Int32, Int64)
 import Data.Monoid (mempty)
 import Data.Text (Text)
 import Data.Time.LocalTime (

  Stm.unsafeWith vec $ \vP ->
    copyBytes vP (buf :: Ptr CInt) (nElems * sizeOf (undefined :: CInt))
  liftM OGRIntegerList (St.unsafeFreeze (Stm.unsafeCast vec))

getFieldBy OFTReal _ ix f
  = liftM (OGRReal . realToFrac)

    deriving (Eq,Show,Read,Bounded) #}

data Field
  = OGRInteger       {-# UNPACK #-} !Int32
  | OGRIntegerList   {-# UNPACK #-} !(St.Vector Int32)
  | OGRInteger64     {-# UNPACK #-} !Int64
  | OGRInteger64List {-# UNPACK #-} !(St.Vector Int64)
  | OGRReal          {-# UNPACK #-} !Double
  | OGRRealList      {-# UNPACK #-} !(St.Vector Double)
  | OGRString        {-# UNPACK #-} !Text
  | OGRStringList    {-# UNPACK #-} !(V.Vector Text)
  | OGRBinary        {-# UNPACK #-} !ByteString
  | OGRDateTime      {-# UNPACK #-} !ZonedTime
  | OGRDate          {-# UNPACK #-} !Day
  | OGRTime          {-# UNPACK #-} !TimeOfDay
  deriving (Show)

data FieldDef
