Skip to content

Commit

Permalink
Update Language.Haskell.Liquid.Types.Generics
Browse files Browse the repository at this point in the history
  • Loading branch information
facundominguez committed Nov 2, 2023
1 parent 12a29f2 commit 2ab08f1
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions liquidhaskell-boot/src/Language/Haskell/Liquid/Types/Generics.hs
Original file line number Diff line number Diff line change
@@ -1,34 +1,19 @@
{- | Geriving instances, generically.
This module shares some of the underlying ideas and implementations of the
[generic-data](https://hackage.haskell.org/package/generic-data-0.8.1.0/docs/Generic-Data.html)
package, allowing us to derive a bunch of instances using the underlying 'Generic' implementation,
but in a more declarative way.
In particular we introduc the 'Generically' newtype wrapper to be used with '-XDerivingVia' to make
derivation explicit. For example:
@
data Foo = Foo
deriving Generic
deriving Eq via Generically Foo
@
{- | Deriving instances of Hashable and Binary, generically.
-}

{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Language.Haskell.Liquid.Types.Generics where
module Language.Haskell.Liquid.Types.Generics() where

import GHC.Generics
import Data.Hashable
import Data.Binary
import Data.Hashable.Generic
import Data.Function

newtype Generically a = Generically a deriving Generic

-- * 'Hashable'

instance (Eq (Generically a), Generic a, GHashable Zero (Rep a)) => Hashable (Generically a) where
Expand Down

0 comments on commit 2ab08f1

Please sign in to comment.