bruderj15 / Hasmtlib

A monad for interfacing with external SMT solvers
GNU General Public License v3.0
12 stars 1 forks source link

Helpful instances for deriving `Codec` #103

Closed bruderj15 closed 2 months ago

bruderj15 commented 2 months ago

Very often we have types like:

data FooBar a = FooBar
  { _fbId  :: Integer
  , _foo   :: a
  , _bar   :: a
  } deriving stock (Generic)
    deriving anyclass (Codec)

This requires:

instance Codec Integer where
  type Decoded Integer = Integer
  decode _ = Just
  encode = id

Provide such helper instances for standard types.