1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
#if __GLASGOW_HASKELL__ >= 806
{-# LANGUAGE DerivingVia #-}
#endif
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-|
Module: Instances.Generic
Copyright: (C) 2014-2017 Ryan Scott
License: BSD-style (see the file LICENSE)
Maintainer: Ryan Scott
Stability: Provisional
Portability: GHC
Provides instances for 'GenericExample', and an 'Arbitrary' instance for 'ConType'.
-}
module Instances.Generic () where
import GHC.Generics (Generic, Generic1)
import Instances.Data.Text ()
import Instances.Utils (GenericExample(..))
import Instances.Utils.GenericArbitrary (genericArbitrary)
import Test.QuickCheck (Arbitrary(..))
import Text.Show.Deriving (deriveShow1)
import TextShow (TextShow(..), TextShow1(..))
import TextShow.Generic ( ConType(..)
#if __GLASGOW_HASKELL__ >= 806
, FromGeneric(..), FromGeneric1(..)
#else
, genericShowbPrec, genericLiftShowbPrec
#endif
)
deriving instance Show a => Show (GenericExample a)
$(deriveShow1 ''GenericExample)
instance Arbitrary a => Arbitrary (GenericExample a) where
arbitrary = genericArbitrary
deriving instance Generic (GenericExample a)
deriving instance Generic1 GenericExample
#if __GLASGOW_HASKELL__ >= 806
deriving via FromGeneric (GenericExample a)
instance TextShow a => TextShow (GenericExample a)
deriving via FromGeneric1 GenericExample
instance TextShow1 GenericExample
#else
instance TextShow a => TextShow (GenericExample a) where
showbPrec = genericShowbPrec
instance TextShow1 GenericExample where
liftShowbPrec = genericLiftShowbPrec
#endif
instance Arbitrary ConType where
arbitrary = genericArbitrary
|