homepage: ''
changelog-type: markdown
hash: 36f1bbdffd936678d115bd81d1ab65786ec220d5ae8ca2e7bffb99d8545befd7
test-bench-deps: {}
maintainer: Baldur Blöndal
synopsis: DerivingVia extras - Miscellaneous /via/ types.
changelog: |
  # Revision history for derivingvia-extras

  ## 0.1.0.0 -- 2022-04-29

  * First version. Added `On` for deriving non-structural instances on a particular record field.
basic-deps:
  base: ==4.*
  hashable: -any
all-versions:
- 0.1.0.0
author: Baldur Blöndal
latest: 0.1.0.0
description-type: markdown
description: |
  # derivingvia-extras

  Miscellaneous via types, for use with `DerivingVia`.

  ## `On`

  The type `On T "field"` derives non-structural instances for `T` by
  comparing an evaluting it only at the record field `"field"`.

  ```haskell
  {-# Language DataKinds     #-}
  {-# Language DerivingVia   #-}
  {-# Language TypeOperators #-}

  import Deriving.On
  import Data.Hashable

  data User = User
    { name   :: String
    , age    :: Int
    , userID :: Integer
    }
    deriving (Eq, Ord, Hashable)
    via User `On` "userID"
  ```

  such that all other fields are ignored

  ```haskell
  >> alice = User "Alice" 50 0xDEADBEAF
  >> bob   = User "Bob"   20 0xDEADBEAF
  >>
  >> alice == bob
  True
  >> alice <= bob
  True
  >> hash alice == hash bob
  True
  ```
license-name: BSD-3-Clause

Update from Hackage at 2022-04-29T01:05:40Z
Update from Hackage at 2022-04-29T01:05:40Z
