Copyright  (C) Koz Ross 2019 

License  GPL version 3.0 or later 
Maintainer  koz.ross@retrofreedom.nz 
Stability  Experimental 
Portability  GHC only 
Safe Haskell  Trustworthy 
Language  Haskell2010 
Knowing that a type a
is an instance of Finitary
gives us the knowledge
that there is an isomorphism between a
and Finite n
for some KnownNat
n
. This gives us a lot of information, which we can exploit to automagically
derive a range of type class instances.
Finiteness
is a newtype
wrapper providing this functionality, while
'reexporting' as many type class instances of the underlying type as
possible. It is designed for use with DerivingVia
 an example of use:
{# LANGUAGE DerivingVia #} {# LANGUAGE DeriveAnyClass #} {# LANGUAGE DeriveGeneric #} import GHC.Generics import Data.Finitary import Data.Finitary.Finiteness import Data.Word import Control.DeepSeq import Data.Hashable import Data.Binary data Foo = Bar  Baz (Word8, Word8)  Quux Word16 deriving (Eq, Generic, Finitary) deriving (Ord, Bounded, NFData, Hashable, Binary) via (Finiteness Foo)
Currently, the following type class instances can be derived in this manner:
Additionally, Finiteness
'forwards' definitions of the following type
classes:
Synopsis
 newtype Finiteness a = Finiteness {
 unFiniteness :: a
Documentation
newtype Finiteness a Source #
Essentially Identity
with a different name. Named this way due to the
wordplay you get from use with DerivingVia
.
Finiteness  
