@hackage / composite-cassava

Csv parsing functionality for composite.

Latest0.0.3.1

About

Metadata

  • Last updated , by locallycompact
  • License MIT
  • Maintained by: dan.firth@homotopic.tech

  • Lottery factor: 0

Links

Installation

Readme

composite-cassava

Provides FromNamedRecord and ToNamedRecord instances for composite records.

In order to use this, use DerivingVia with one of the newtypes, depending on your use case. The recommended way is like so:

withLensesAndProxies
  [d|
    type A = "A" :-> Text

    type B = "B" :-> Double

    type C = "C" :-> Text

    type D = "D" :-> Int
    |]

type RecMaybe = Rec Maybe '[A, B, C, D]

deriving newtype instance FromField A

deriving newtype instance FromField B

deriving newtype instance FromField C

deriving newtype instance FromField D

deriving newtype instance ToField A

deriving newtype instance ToField B

deriving newtype instance ToField C

deriving newtype instance ToField D

deriving via (TF Maybe '[A, B, C, D]) instance FromNamedRecord RecMaybe

deriving via (TF Maybe '[A, B, C, D]) instance ToNamedRecord RecMaybe