-- | A constructor for @RecordT@s that selects the @i@th constructor
-- from the left. This starts from 0.
recordTAt :: forall a. Data a => Int -> Maybe (RecordT a)
recordTAt i = guard (length cs > i && length (fields r) > 0) >> Just r
  where cs = dataTypeConstrs . dataTypeOf $ (undefined :: a)
        r = RecordT (cs !! i) (constrFields $ cs !! i) :: RecordT a

-- | Returns the fields for the record @a@
recordTAt :: forall a. Data a => Int -> Maybe (RecordT a)
recordTAt i = guard (length cs > i && length (fields r) > 0) >> Just r
  where cs = dataTypeConstrs . dataTypeOf $ (undefined :: a)
        r = RecordT (cs !! i) (constrFields $ cs !! i) :: RecordT a

-- | Returns the fields for the record @a@
recordTAt i = guard (length cs > i && length (fields r) > 0) >> Just r
  where cs = dataTypeConstrs . dataTypeOf $ (undefined :: a)
        r = RecordT (cs !! i) (constrFields $ cs !! i) :: RecordT a

-- | Returns the fields for the record @a@