Skip to content

Get the field names #184

@idontgetoutmuch

Description

@idontgetoutmuch

This seems useful to me. We could add it to StripFieldNames but then the name doesn't indicate that you can also get the names as well as strip them.

class GetFieldNames (ts :: [(Symbol, Type)]) where
  getNames :: Rec ElField ts -> [String]

instance GetFieldNames '[] where
  getNames _ = []

instance (KnownSymbol s, GetFieldNames ts) => GetFieldNames ('(s, t) ': ts)  where
  getNames _ = symbolVal (Proxy :: Proxy s) : getNames (undefined :: Rec ElField ts)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions