    {-|
    Copyright  :  (C) 2017-2019, Myrtle Software
                      2022,      QBayLogic B.V.
    License    :  BSD2 (see the file LICENSE)
    Maintainer :  QBayLogic B.V. <devops@qbaylogic.com>

    Instruct the Clash compiler to look for primitive HDL templates provided inline
    or in a specified directory. For distribution of new packages with primitive
    HDL templates. Primitive guards can be added to warn on instantiating
    primitives.
    -}

    {-# LANGUAGE DeriveAnyClass #-}
    {-# LANGUAGE LambdaCase #-}
    {-# LANGUAGE NoGeneralizedNewtypeDeriving #-}
    {-# LANGUAGE TemplateHaskellQuotes #-}

    {-# LANGUAGE Safe #-}

    {-# OPTIONS_HADDOCK show-extensions #-}

    module Clash.Annotations.Primitive
      ( dontTranslate
      , hasBlackBox
      , warnNonSynthesizable
      , warnAlways
      , Primitive(..)
      , HDL(..)
      , PrimitiveGuard(..)
      , PrimitiveWarning(..)
      , extractPrim
      , extractWarnings
      ) where

    import           Control.DeepSeq                          (NFData)
    import           Data.Binary                              (Binary)
    import           Data.Data
    import           Data.Hashable                            (Hashable)
    import           GHC.Generics                             (Generic)

    -- The commented code directly below this comment is affected by an old
    -- GHC bug: https://gitlab.haskell.org/ghc/ghc/-/issues/5463. In short, NOINLINE
    -- pragmas generated by Template Haskell, get ignored. We'd still like a better
    -- API than manually having to write all the guard/inline pragmas some day,
    -- so I'm leaving the code in for now.

    {-

    guard :: TH.Exp -> TH.Name -> TH.Q [TH.Dec]
    guard guardExpr fName =
      pure
        [ TH.PragmaD (TH.InlineP fName TH.NoInline TH.FunLike TH.AllPhases)
        , TH.PragmaD (TH.AnnP (TH.ValueAnnotation fName) (TH.SigE guardExpr typ))
        ]
      where
        typ = TH.AppT (TH.ConT ''PrimitiveGuard) (TH.TupleT 0)

    applyUnit :: TH.Exp -> TH.Exp
    applyUnit e = TH.AppE e (TH.TupE [])

    -- | Mark a function as having a primitive. Clash will yield an error if it
    -- needs to translate this function, but no blackbox was loaded. Usage:
    --
    -- @
    -- $(hasBlackBox 'f)
    -- @
    --
    -- If you don't want to use TemplateHaskell, add these annotations:
    --
    -- @
    -- {-# NOINLINE f #-}
    -- {-# ANN f (HasBlackBox ()) #-}
    -- @
    --
    hasBlackBox :: TH.Name -> TH.Q [TH.Dec]
    hasBlackBox = guard (applyUnit (TH.ConE 'HasBlackBox))

    -- | Mark a function as non translatable. Clash will yield an error if
    -- it needs to translate this function. Usage:
    --
    -- @
    -- $(dontTranslate 'f)
    -- @
    --
    -- If you don't want to use TemplateHaskell, add these annotations:
    --
    -- @
    -- {-# NOINLINE f #-}
    -- {-# ANN f DontTranslate #-}
    -- @
    --
    dontTranslate :: TH.Name -> TH.Q [TH.Dec]
    dontTranslate = guard (TH.ConE 'DontTranslate)

    -- | Mark a function as non synthesizable. Clash will emit the given warning
    -- if instantiated outside of a testbench context. Usage:
    --
    -- @
    -- $(warnNonSynthesizable 'f "Tread carefully, user!")
    -- @
    --
    -- If you don't want to use TemplateHaskell, add these annotations:
    --
    -- @
    -- {-# NOINLINE f #-}
    -- {-# ANN f (WarnNonSynthesizable "Tread carefully, user!" ()) #-}
    -- @
    --
    warnNotSynthesizable :: TH.Name -> String -> TH.Q [TH.Dec]
    warnNotSynthesizable nm warning =
      guard
        (applyUnit
          (TH.AppE
            (TH.ConE 'WarnNonSynthesizable)
            (TH.LitE (TH.StringL warning))))
        nm

    -- | Emit warning when translating this value.
    --
    -- @
    -- $(warnAlways 'f "Tread carefully, user!")
    -- @
    --
    -- If you don't want to use TemplateHaskell, add these annotations:
    --
    -- @
    -- {-# NOINLINE f #-}
    -- {-# ANN f (WarnAlways "Tread carefully, user!" ()) #-}
    -- @
    --
    warnAlways :: TH.Name -> String -> TH.Q [TH.Dec]
    warnAlways nm warning =
      guard
        (applyUnit
          (TH.AppE
            (TH.ConE 'WarnAlways)
            (TH.LitE (TH.StringL warning))))
        nm
    -}

    -- | Marks value as not translatable. Clash will error if it finds a blackbox
    -- definition for it, or when it is forced to translate it. You can annotate a
    -- variable or function @f@ like:
    --
    -- @
    -- {\-\# ANN f dontTranslate \#-\}
    -- @
    dontTranslate :: PrimitiveGuard ()
    dontTranslate :: PrimitiveGuard ()
    dontTranslate = PrimitiveGuard ()
    forall a. PrimitiveGuard a
    DontTranslate

    -- | Marks a value as having a blackbox. Clash will error if it hasn't found
    -- a blackbox. You can annotate a variable or function @f@ like:
    --
    -- @
    -- {\-\# ANN f hasBlackBox \#-\}
    -- @
    hasBlackBox :: PrimitiveGuard ()
    hasBlackBox :: PrimitiveGuard ()
    hasBlackBox = [PrimitiveWarning] -> () -> PrimitiveGuard ()
    forall a. [PrimitiveWarning] -> a -> PrimitiveGuard a
    HasBlackBox [] ()

    -- | Marks value as non-synthesizable. This will trigger a warning if
    -- instantiated in a non-testbench context. You can annotate a variable or
    -- function @f@ like:
    --
    -- @
    -- {\-\# ANN f (warnNonSynthesizable "Tread carefully, user!") \#-\}
    -- @
    --
    -- Implies `hasBlackBox`.
    warnNonSynthesizable :: String -> PrimitiveGuard ()
    warnNonSynthesizable :: String -> PrimitiveGuard ()
    warnNonSynthesizable String
    s = [PrimitiveWarning] -> () -> PrimitiveGuard ()
    forall a. [PrimitiveWarning] -> a -> PrimitiveGuard a
    HasBlackBox [String -> PrimitiveWarning
    WarnNonSynthesizable String
    s] ()

    -- | Always emit warning upon primitive instantiation. You can annotate a
    -- variable or function @f@ like:
    --
    -- @
    -- {\-\# ANN f (warnAlways "Tread carefully, user!") \#-\}
    -- @
    --
    -- Implies `hasBlackBox`.
    warnAlways :: String -> PrimitiveGuard ()
    warnAlways :: String -> PrimitiveGuard ()
    warnAlways String
    s = [PrimitiveWarning] -> () -> PrimitiveGuard ()
    forall a. [PrimitiveWarning] -> a -> PrimitiveGuard a
    HasBlackBox [String -> PrimitiveWarning
    WarnAlways String
    s] ()

    -- | A compilation target HDL.
    data HDL
      = SystemVerilog
      | Verilog
      | VHDL
      deriving (HDL -> HDL -> Bool
    (HDL -> HDL -> Bool) -> (HDL -> HDL -> Bool) -> Eq HDL
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: HDL -> HDL -> Bool
    == :: HDL -> HDL -> Bool
    $c/= :: HDL -> HDL -> Bool
    /= :: HDL -> HDL -> Bool
    Eq, Int -> HDL -> ShowS
    [HDL] -> ShowS
    HDL -> String
    (Int -> HDL -> ShowS)
    -> (HDL -> String) -> ([HDL] -> ShowS) -> Show HDL
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> HDL -> ShowS
    showsPrec :: Int -> HDL -> ShowS
    $cshow :: HDL -> String
    show :: HDL -> String
    $cshowList :: [HDL] -> ShowS
    showList :: [HDL] -> ShowS
    Show, ReadPrec [HDL]
    ReadPrec HDL
    Int -> ReadS HDL
    ReadS [HDL]
    (Int -> ReadS HDL)
    -> ReadS [HDL] -> ReadPrec HDL -> ReadPrec [HDL] -> Read HDL
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS HDL
    readsPrec :: Int -> ReadS HDL
    $creadList :: ReadS [HDL]
    readList :: ReadS [HDL]
    $creadPrec :: ReadPrec HDL
    readPrec :: ReadPrec HDL
    $creadListPrec :: ReadPrec [HDL]
    readListPrec :: ReadPrec [HDL]
    Read, Typeable HDL
    Typeable HDL =>
    (forall (c :: Type -> Type).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> HDL -> c HDL)
    -> (forall (c :: Type -> Type).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c HDL)
    -> (HDL -> Constr)
    -> (HDL -> DataType)
    -> (forall (t :: Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c HDL))
    -> (forall (t :: Type -> Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HDL))
    -> ((forall b. Data b => b -> b) -> HDL -> HDL)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HDL -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HDL -> r)
    -> (forall u. (forall d. Data d => d -> u) -> HDL -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> HDL -> u)
    -> (forall (m :: Type -> Type).
        Monad m =>
        (forall d. Data d => d -> m d) -> HDL -> m HDL)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> HDL -> m HDL)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> HDL -> m HDL)
    -> Data HDL
    HDL -> Constr
    HDL -> DataType
    (forall b. Data b => b -> b) -> HDL -> HDL
    forall a.
    Typeable a =>
    (forall (c :: Type -> Type).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: Type -> Type).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: Type -> Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: Type -> Type).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> HDL -> u
    forall u. (forall d. Data d => d -> u) -> HDL -> [u]
    forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HDL -> r
    forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HDL -> r
    forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d) -> HDL -> m HDL
    forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> HDL -> m HDL
    forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c HDL
    forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> HDL -> c HDL
    forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c HDL)
    forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HDL)
    $cgfoldl :: forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> HDL -> c HDL
    gfoldl :: forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> HDL -> c HDL
    $cgunfold :: forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c HDL
    gunfold :: forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c HDL
    $ctoConstr :: HDL -> Constr
    toConstr :: HDL -> Constr
    $cdataTypeOf :: HDL -> DataType
    dataTypeOf :: HDL -> DataType
    $cdataCast1 :: forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c HDL)
    dataCast1 :: forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c HDL)
    $cdataCast2 :: forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HDL)
    dataCast2 :: forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HDL)
    $cgmapT :: (forall b. Data b => b -> b) -> HDL -> HDL
    gmapT :: (forall b. Data b => b -> b) -> HDL -> HDL
    $cgmapQl :: forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HDL -> r
    gmapQl :: forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HDL -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HDL -> r
    gmapQr :: forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HDL -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> HDL -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> HDL -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> HDL -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> HDL -> u
    $cgmapM :: forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d) -> HDL -> m HDL
    gmapM :: forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d) -> HDL -> m HDL
    $cgmapMp :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> HDL -> m HDL
    gmapMp :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> HDL -> m HDL
    $cgmapMo :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> HDL -> m HDL
    gmapMo :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> HDL -> m HDL
    Data, (forall x. HDL -> Rep HDL x)
    -> (forall x. Rep HDL x -> HDL) -> Generic HDL
    forall x. Rep HDL x -> HDL
    forall x. HDL -> Rep HDL x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. HDL -> Rep HDL x
    from :: forall x. HDL -> Rep HDL x
    $cto :: forall x. Rep HDL x -> HDL
    to :: forall x. Rep HDL x -> HDL
    Generic, HDL -> ()
    (HDL -> ()) -> NFData HDL
    forall a. (a -> ()) -> NFData a
    $crnf :: HDL -> ()
    rnf :: HDL -> ()
    NFData, Eq HDL
    Eq HDL => (Int -> HDL -> Int) -> (HDL -> Int) -> Hashable HDL
    Int -> HDL -> Int
    HDL -> Int
    forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
    $chashWithSalt :: Int -> HDL -> Int
    hashWithSalt :: Int -> HDL -> Int
    $chash :: HDL -> Int
    hash :: HDL -> Int
    Hashable, Int -> HDL
    HDL -> Int
    HDL -> [HDL]
    HDL -> HDL
    HDL -> HDL -> [HDL]
    HDL -> HDL -> HDL -> [HDL]
    (HDL -> HDL)
    -> (HDL -> HDL)
    -> (Int -> HDL)
    -> (HDL -> Int)
    -> (HDL -> [HDL])
    -> (HDL -> HDL -> [HDL])
    -> (HDL -> HDL -> [HDL])
    -> (HDL -> HDL -> HDL -> [HDL])
    -> Enum HDL
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: HDL -> HDL
    succ :: HDL -> HDL
    $cpred :: HDL -> HDL
    pred :: HDL -> HDL
    $ctoEnum :: Int -> HDL
    toEnum :: Int -> HDL
    $cfromEnum :: HDL -> Int
    fromEnum :: HDL -> Int
    $cenumFrom :: HDL -> [HDL]
    enumFrom :: HDL -> [HDL]
    $cenumFromThen :: HDL -> HDL -> [HDL]
    enumFromThen :: HDL -> HDL -> [HDL]
    $cenumFromTo :: HDL -> HDL -> [HDL]
    enumFromTo :: HDL -> HDL -> [HDL]
    $cenumFromThenTo :: HDL -> HDL -> HDL -> [HDL]
    enumFromThenTo :: HDL -> HDL -> HDL -> [HDL]
    Enum, HDL
    HDL -> HDL -> Bounded HDL
    forall a. a -> a -> Bounded a
    $cminBound :: HDL
    minBound :: HDL
    $cmaxBound :: HDL
    maxBound :: HDL
    Bounded)

    -- | The 'Primitive' constructor instructs the clash compiler to look for primitive
    -- HDL templates in the indicated directory. 'InlinePrimitive' is equivalent but
    -- provides the HDL template inline. They are intended for the distribution of
    -- new packages with primitive HDL templates.
    --
    -- === Example of 'Primitive'
    --
    -- You have some existing IP written in one of HDLs supported by Clash, and
    -- you want to distribute some bindings so that the IP can be easily instantiated
    -- from Clash.
    --
    -- You create a package which has a @myfancyip.cabal@ file with the following stanza:
    --
    -- > data-files: path/to/MyFancyIP.primitives
    -- > cpp-options: -DCABAL
    --
    -- and a @MyFancyIP.hs@ module with the simulation definition and primitive.
    --
    -- @
    -- module MyFancyIP where
    --
    -- import Clash.Prelude
    --
    -- myFancyIP :: ...
    -- myFancyIP = ...
    -- {\-\# NOINLINE myFancyIP \#-\}
    -- @
    --
    -- The @NOINLINE@ pragma is needed so that GHC will never inline the definition.
    --
    -- Now you need to add the following imports and @ANN@ pragma:
    --
    -- @
    -- \#ifdef CABAL
    -- import           Clash.Annotations.Primitive
    -- import           System.FilePath
    -- import qualified Paths_myfancyip
    -- import           System.IO.Unsafe
    --
    -- {\-\# ANN module (Primitive [VHDL] (unsafePerformIO Paths_myfancyip.getDataDir \<\/\> "path" \<\/\> "to")) \#-\}
    -- \#endif
    -- @
    --
    -- Add more files to the @data-files@ stanza in your @.cabal@ files and more
    -- @ANN@ pragma's if you want to add more primitive templates for other HDLs
    --
    -- === Example of 'InlineYamlPrimitive'
    --
    -- The following example shows off an inline HDL primitive template. It uses the
    -- [string-interpolate](https://hackage.haskell.org/package/string-interpolate)
    -- package for nicer multiline strings.
    --
    -- @
    -- {\-\# LANGUAGE QuasiQuotes \#-\}
    -- module InlinePrimitive where
    --
    -- import           Clash.Annotations.Primitive
    -- import           Clash.Prelude
    -- import           Data.String.Interpolate      (__i)
    --
    -- {\-\# ANN example (InlineYamlPrimitive [VHDL] [__i|
    --   BlackBox:
    --     kind: Declaration
    --     name: InlinePrimitive.example
    --     template: |-
    --       -- begin InlinePrimitive example:
    --       ~GENSYM[example][0] : block
    --       ~RESULT <= 1 + ~ARG[0];
    --       end block;
    --       -- end InlinePrimitive example
    --   |]) \#-\}
    -- {\-\# NOINLINE example \#-\}
    -- example :: Signal System (BitVector 2) -> Signal System (BitVector 2)
    -- example = fmap succ
    -- @
    data Primitive
      = Primitive [HDL] FilePath
      -- ^ Description of a primitive for a given 'HDL's in a file at 'FilePath'
      | InlinePrimitive [HDL] String
      -- ^ Description of a primitive for a given 'HDL's as an inline JSON 'String'
      | InlineYamlPrimitive [HDL] String
      -- ^ Description of a primitive for a given 'HDL's as an inline YAML 'String'
      deriving (Int -> Primitive -> ShowS
    [Primitive] -> ShowS
    Primitive -> String
    (Int -> Primitive -> ShowS)
    -> (Primitive -> String)
    -> ([Primitive] -> ShowS)
    -> Show Primitive
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Primitive -> ShowS
    showsPrec :: Int -> Primitive -> ShowS
    $cshow :: Primitive -> String
    show :: Primitive -> String
    $cshowList :: [Primitive] -> ShowS
    showList :: [Primitive] -> ShowS
    Show, ReadPrec [Primitive]
    ReadPrec Primitive
    Int -> ReadS Primitive
    ReadS [Primitive]
    (Int -> ReadS Primitive)
    -> ReadS [Primitive]
    -> ReadPrec Primitive
    -> ReadPrec [Primitive]
    -> Read Primitive
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS Primitive
    readsPrec :: Int -> ReadS Primitive
    $creadList :: ReadS [Primitive]
    readList :: ReadS [Primitive]
    $creadPrec :: ReadPrec Primitive
    readPrec :: ReadPrec Primitive
    $creadListPrec :: ReadPrec [Primitive]
    readListPrec :: ReadPrec [Primitive]
    Read, Typeable Primitive
    Typeable Primitive =>
    (forall (c :: Type -> Type).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> Primitive -> c Primitive)
    -> (forall (c :: Type -> Type).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c Primitive)
    -> (Primitive -> Constr)
    -> (Primitive -> DataType)
    -> (forall (t :: Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c Primitive))
    -> (forall (t :: Type -> Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Primitive))
    -> ((forall b. Data b => b -> b) -> Primitive -> Primitive)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> Primitive -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> Primitive -> r)
    -> (forall u. (forall d. Data d => d -> u) -> Primitive -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> Primitive -> u)
    -> (forall (m :: Type -> Type).
        Monad m =>
        (forall d. Data d => d -> m d) -> Primitive -> m Primitive)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> Primitive -> m Primitive)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> Primitive -> m Primitive)
    -> Data Primitive
    Primitive -> Constr
    Primitive -> DataType
    (forall b. Data b => b -> b) -> Primitive -> Primitive
    forall a.
    Typeable a =>
    (forall (c :: Type -> Type).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: Type -> Type).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: Type -> Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: Type -> Type).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> Primitive -> u
    forall u. (forall d. Data d => d -> u) -> Primitive -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Primitive -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Primitive -> r
    forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d) -> Primitive -> m Primitive
    forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Primitive -> m Primitive
    forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Primitive
    forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Primitive -> c Primitive
    forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Primitive)
    forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Primitive)
    $cgfoldl :: forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Primitive -> c Primitive
    gfoldl :: forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Primitive -> c Primitive
    $cgunfold :: forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Primitive
    gunfold :: forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Primitive
    $ctoConstr :: Primitive -> Constr
    toConstr :: Primitive -> Constr
    $cdataTypeOf :: Primitive -> DataType
    dataTypeOf :: Primitive -> DataType
    $cdataCast1 :: forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Primitive)
    dataCast1 :: forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Primitive)
    $cdataCast2 :: forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Primitive)
    dataCast2 :: forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Primitive)
    $cgmapT :: (forall b. Data b => b -> b) -> Primitive -> Primitive
    gmapT :: (forall b. Data b => b -> b) -> Primitive -> Primitive
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Primitive -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Primitive -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Primitive -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Primitive -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> Primitive -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> Primitive -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Primitive -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Primitive -> u
    $cgmapM :: forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d) -> Primitive -> m Primitive
    gmapM :: forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d) -> Primitive -> m Primitive
    $cgmapMp :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Primitive -> m Primitive
    gmapMp :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Primitive -> m Primitive
    $cgmapMo :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Primitive -> m Primitive
    gmapMo :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Primitive -> m Primitive
    Data, (forall x. Primitive -> Rep Primitive x)
    -> (forall x. Rep Primitive x -> Primitive) -> Generic Primitive
    forall x. Rep Primitive x -> Primitive
    forall x. Primitive -> Rep Primitive x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. Primitive -> Rep Primitive x
    from :: forall x. Primitive -> Rep Primitive x
    $cto :: forall x. Rep Primitive x -> Primitive
    to :: forall x. Rep Primitive x -> Primitive
    Generic, Primitive -> ()
    (Primitive -> ()) -> NFData Primitive
    forall a. (a -> ()) -> NFData a
    $crnf :: Primitive -> ()
    rnf :: Primitive -> ()
    NFData, Eq Primitive
    Eq Primitive =>
    (Int -> Primitive -> Int)
    -> (Primitive -> Int) -> Hashable Primitive
    Int -> Primitive -> Int
    Primitive -> Int
    forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
    $chashWithSalt :: Int -> Primitive -> Int
    hashWithSalt :: Int -> Primitive -> Int
    $chash :: Primitive -> Int
    hash :: Primitive -> Int
    Hashable, Primitive -> Primitive -> Bool
    (Primitive -> Primitive -> Bool)
    -> (Primitive -> Primitive -> Bool) -> Eq Primitive
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Primitive -> Primitive -> Bool
    == :: Primitive -> Primitive -> Bool
    $c/= :: Primitive -> Primitive -> Bool
    /= :: Primitive -> Primitive -> Bool
    Eq)

    -- | Primitive guard to mark a value as either not translatable or as having a
    -- blackbox with an optional extra warning. Helps Clash generate better error
    -- messages.
    --
    -- For use, see 'dontTranslate', 'hasBlackBox', 'warnNonSynthesizable' and
    -- 'warnAlways'.
    data PrimitiveGuard a
      = DontTranslate
      -- ^ Marks value as not translatable. Clash will error if it finds a blackbox
      -- definition for it, or when it is forced to translate it.
      | HasBlackBox [PrimitiveWarning] a
      -- ^ Marks a value as having a blackbox. Clash will error if it hasn't found
      -- a blackbox.
      deriving
        ( Int -> PrimitiveGuard a -> ShowS
    [PrimitiveGuard a] -> ShowS
    PrimitiveGuard a -> String
    (Int -> PrimitiveGuard a -> ShowS)
    -> (PrimitiveGuard a -> String)
    -> ([PrimitiveGuard a] -> ShowS)
    -> Show (PrimitiveGuard a)
    forall a. Show a => Int -> PrimitiveGuard a -> ShowS
    forall a. Show a => [PrimitiveGuard a] -> ShowS
    forall a. Show a => PrimitiveGuard a -> String
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: forall a. Show a => Int -> PrimitiveGuard a -> ShowS
    showsPrec :: Int -> PrimitiveGuard a -> ShowS
    $cshow :: forall a. Show a => PrimitiveGuard a -> String
    show :: PrimitiveGuard a -> String
    $cshowList :: forall a. Show a => [PrimitiveGuard a] -> ShowS
    showList :: [PrimitiveGuard a] -> ShowS
    Show, ReadPrec [PrimitiveGuard a]
    ReadPrec (PrimitiveGuard a)
    Int -> ReadS (PrimitiveGuard a)
    ReadS [PrimitiveGuard a]
    (Int -> ReadS (PrimitiveGuard a))
    -> ReadS [PrimitiveGuard a]
    -> ReadPrec (PrimitiveGuard a)
    -> ReadPrec [PrimitiveGuard a]
    -> Read (PrimitiveGuard a)
    forall a. Read a => ReadPrec [PrimitiveGuard a]
    forall a. Read a => ReadPrec (PrimitiveGuard a)
    forall a. Read a => Int -> ReadS (PrimitiveGuard a)
    forall a. Read a => ReadS [PrimitiveGuard a]
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: forall a. Read a => Int -> ReadS (PrimitiveGuard a)
    readsPrec :: Int -> ReadS (PrimitiveGuard a)
    $creadList :: forall a. Read a => ReadS [PrimitiveGuard a]
    readList :: ReadS [PrimitiveGuard a]
    $creadPrec :: forall a. Read a => ReadPrec (PrimitiveGuard a)
    readPrec :: ReadPrec (PrimitiveGuard a)
    $creadListPrec :: forall a. Read a => ReadPrec [PrimitiveGuard a]
    readListPrec :: ReadPrec [PrimitiveGuard a]
    Read, Typeable (PrimitiveGuard a)
    Typeable (PrimitiveGuard a) =>
    (forall (c :: Type -> Type).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g)
     -> PrimitiveGuard a
     -> c (PrimitiveGuard a))
    -> (forall (c :: Type -> Type).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c (PrimitiveGuard a))
    -> (PrimitiveGuard a -> Constr)
    -> (PrimitiveGuard a -> DataType)
    -> (forall (t :: Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c (PrimitiveGuard a)))
    -> (forall (t :: Type -> Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c (PrimitiveGuard a)))
    -> ((forall b. Data b => b -> b)
        -> PrimitiveGuard a -> PrimitiveGuard a)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> PrimitiveGuard a -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> PrimitiveGuard a -> r)
    -> (forall u.
        (forall d. Data d => d -> u) -> PrimitiveGuard a -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> PrimitiveGuard a -> u)
    -> (forall (m :: Type -> Type).
        Monad m =>
        (forall d. Data d => d -> m d)
        -> PrimitiveGuard a -> m (PrimitiveGuard a))
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d)
        -> PrimitiveGuard a -> m (PrimitiveGuard a))
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d)
        -> PrimitiveGuard a -> m (PrimitiveGuard a))
    -> Data (PrimitiveGuard a)
    PrimitiveGuard a -> Constr
    PrimitiveGuard a -> DataType
    (forall b. Data b => b -> b)
    -> PrimitiveGuard a -> PrimitiveGuard a
    forall a. Data a => Typeable (PrimitiveGuard a)
    forall a. Data a => PrimitiveGuard a -> Constr
    forall a. Data a => PrimitiveGuard a -> DataType
    forall a.
    Data a =>
    (forall b. Data b => b -> b)
    -> PrimitiveGuard a -> PrimitiveGuard a
    forall a u.
    Data a =>
    Int -> (forall d. Data d => d -> u) -> PrimitiveGuard a -> u
    forall a u.
    Data a =>
    (forall d. Data d => d -> u) -> PrimitiveGuard a -> [u]
    forall a r r'.
    Data a =>
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> PrimitiveGuard a -> r
    forall a r r'.
    Data a =>
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> PrimitiveGuard a -> r
    forall a (m :: Type -> Type).
    (Data a, Monad m) =>
    (forall d. Data d => d -> m d)
    -> PrimitiveGuard a -> m (PrimitiveGuard a)
    forall a (m :: Type -> Type).
    (Data a, MonadPlus m) =>
    (forall d. Data d => d -> m d)
    -> PrimitiveGuard a -> m (PrimitiveGuard a)
    forall a (c :: Type -> Type).
    Data a =>
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (PrimitiveGuard a)
    forall a (c :: Type -> Type).
    Data a =>
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> PrimitiveGuard a -> c (PrimitiveGuard a)
    forall a (t :: Type -> Type) (c :: Type -> Type).
    (Data a, Typeable t) =>
    (forall d. Data d => c (t d)) -> Maybe (c (PrimitiveGuard a))
    forall a (t :: Type -> Type -> Type) (c :: Type -> Type).
    (Data a, Typeable t) =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (PrimitiveGuard a))
    forall a.
    Typeable a =>
    (forall (c :: Type -> Type).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: Type -> Type).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: Type -> Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: Type -> Type).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u.
    Int -> (forall d. Data d => d -> u) -> PrimitiveGuard a -> u
    forall u. (forall d. Data d => d -> u) -> PrimitiveGuard a -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> PrimitiveGuard a -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> PrimitiveGuard a -> r
    forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> PrimitiveGuard a -> m (PrimitiveGuard a)
    forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> PrimitiveGuard a -> m (PrimitiveGuard a)
    forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (PrimitiveGuard a)
    forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> PrimitiveGuard a -> c (PrimitiveGuard a)
    forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (PrimitiveGuard a))
    forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (PrimitiveGuard a))
    $cgfoldl :: forall a (c :: Type -> Type).
    Data a =>
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> PrimitiveGuard a -> c (PrimitiveGuard a)
    gfoldl :: forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> PrimitiveGuard a -> c (PrimitiveGuard a)
    $cgunfold :: forall a (c :: Type -> Type).
    Data a =>
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (PrimitiveGuard a)
    gunfold :: forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (PrimitiveGuard a)
    $ctoConstr :: forall a. Data a => PrimitiveGuard a -> Constr
    toConstr :: PrimitiveGuard a -> Constr
    $cdataTypeOf :: forall a. Data a => PrimitiveGuard a -> DataType
    dataTypeOf :: PrimitiveGuard a -> DataType
    $cdataCast1 :: forall a (t :: Type -> Type) (c :: Type -> Type).
    (Data a, Typeable t) =>
    (forall d. Data d => c (t d)) -> Maybe (c (PrimitiveGuard a))
    dataCast1 :: forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (PrimitiveGuard a))
    $cdataCast2 :: forall a (t :: Type -> Type -> Type) (c :: Type -> Type).
    (Data a, Typeable t) =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (PrimitiveGuard a))
    dataCast2 :: forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (PrimitiveGuard a))
    $cgmapT :: forall a.
    Data a =>
    (forall b. Data b => b -> b)
    -> PrimitiveGuard a -> PrimitiveGuard a
    gmapT :: (forall b. Data b => b -> b)
    -> PrimitiveGuard a -> PrimitiveGuard a
    $cgmapQl :: forall a r r'.
    Data a =>
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> PrimitiveGuard a -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> PrimitiveGuard a -> r
    $cgmapQr :: forall a r r'.
    Data a =>
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> PrimitiveGuard a -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> PrimitiveGuard a -> r
    $cgmapQ :: forall a u.
    Data a =>
    (forall d. Data d => d -> u) -> PrimitiveGuard a -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> PrimitiveGuard a -> [u]
    $cgmapQi :: forall a u.
    Data a =>
    Int -> (forall d. Data d => d -> u) -> PrimitiveGuard a -> u
    gmapQi :: forall u.
    Int -> (forall d. Data d => d -> u) -> PrimitiveGuard a -> u
    $cgmapM :: forall a (m :: Type -> Type).
    (Data a, Monad m) =>
    (forall d. Data d => d -> m d)
    -> PrimitiveGuard a -> m (PrimitiveGuard a)
    gmapM :: forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> PrimitiveGuard a -> m (PrimitiveGuard a)
    $cgmapMp :: forall a (m :: Type -> Type).
    (Data a, MonadPlus m) =>
    (forall d. Data d => d -> m d)
    -> PrimitiveGuard a -> m (PrimitiveGuard a)
    gmapMp :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> PrimitiveGuard a -> m (PrimitiveGuard a)
    $cgmapMo :: forall a (m :: Type -> Type).
    (Data a, MonadPlus m) =>
    (forall d. Data d => d -> m d)
    -> PrimitiveGuard a -> m (PrimitiveGuard a)
    gmapMo :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> PrimitiveGuard a -> m (PrimitiveGuard a)
    Data, (forall x. PrimitiveGuard a -> Rep (PrimitiveGuard a) x)
    -> (forall x. Rep (PrimitiveGuard a) x -> PrimitiveGuard a)
    -> Generic (PrimitiveGuard a)
    forall x. Rep (PrimitiveGuard a) x -> PrimitiveGuard a
    forall x. PrimitiveGuard a -> Rep (PrimitiveGuard a) x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    forall a x. Rep (PrimitiveGuard a) x -> PrimitiveGuard a
    forall a x. PrimitiveGuard a -> Rep (PrimitiveGuard a) x
    $cfrom :: forall a x. PrimitiveGuard a -> Rep (PrimitiveGuard a) x
    from :: forall x. PrimitiveGuard a -> Rep (PrimitiveGuard a) x
    $cto :: forall a x. Rep (PrimitiveGuard a) x -> PrimitiveGuard a
    to :: forall x. Rep (PrimitiveGuard a) x -> PrimitiveGuard a
    Generic, PrimitiveGuard a -> ()
    (PrimitiveGuard a -> ()) -> NFData (PrimitiveGuard a)
    forall a. NFData a => PrimitiveGuard a -> ()
    forall a. (a -> ()) -> NFData a
    $crnf :: forall a. NFData a => PrimitiveGuard a -> ()
    rnf :: PrimitiveGuard a -> ()
    NFData, Eq (PrimitiveGuard a)
    Eq (PrimitiveGuard a) =>
    (Int -> PrimitiveGuard a -> Int)
    -> (PrimitiveGuard a -> Int) -> Hashable (PrimitiveGuard a)
    Int -> PrimitiveGuard a -> Int
    PrimitiveGuard a -> Int
    forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
    forall a. Hashable a => Eq (PrimitiveGuard a)
    forall a. Hashable a => Int -> PrimitiveGuard a -> Int
    forall a. Hashable a => PrimitiveGuard a -> Int
    $chashWithSalt :: forall a. Hashable a => Int -> PrimitiveGuard a -> Int
    hashWithSalt :: Int -> PrimitiveGuard a -> Int
    $chash :: forall a. Hashable a => PrimitiveGuard a -> Int
    hash :: PrimitiveGuard a -> Int
    Hashable, (forall a b. (a -> b) -> PrimitiveGuard a -> PrimitiveGuard b)
    -> (forall a b. a -> PrimitiveGuard b -> PrimitiveGuard a)
    -> Functor PrimitiveGuard
    forall a b. a -> PrimitiveGuard b -> PrimitiveGuard a
    forall a b. (a -> b) -> PrimitiveGuard a -> PrimitiveGuard b
    forall (f :: Type -> Type).
    (forall a b. (a -> b) -> f a -> f b)
    -> (forall a b. a -> f b -> f a) -> Functor f
    $cfmap :: forall a b. (a -> b) -> PrimitiveGuard a -> PrimitiveGuard b
    fmap :: forall a b. (a -> b) -> PrimitiveGuard a -> PrimitiveGuard b
    $c<$ :: forall a b. a -> PrimitiveGuard b -> PrimitiveGuard a
    <$ :: forall a b. a -> PrimitiveGuard b -> PrimitiveGuard a
    Functor, (forall m. Monoid m => PrimitiveGuard m -> m)
    -> (forall m a. Monoid m => (a -> m) -> PrimitiveGuard a -> m)
    -> (forall m a. Monoid m => (a -> m) -> PrimitiveGuard a -> m)
    -> (forall a b. (a -> b -> b) -> b -> PrimitiveGuard a -> b)
    -> (forall a b. (a -> b -> b) -> b -> PrimitiveGuard a -> b)
    -> (forall b a. (b -> a -> b) -> b -> PrimitiveGuard a -> b)
    -> (forall b a. (b -> a -> b) -> b -> PrimitiveGuard a -> b)
    -> (forall a. (a -> a -> a) -> PrimitiveGuard a -> a)
    -> (forall a. (a -> a -> a) -> PrimitiveGuard a -> a)
    -> (forall a. PrimitiveGuard a -> [a])
    -> (forall a. PrimitiveGuard a -> Bool)
    -> (forall a. PrimitiveGuard a -> Int)
    -> (forall a. Eq a => a -> PrimitiveGuard a -> Bool)
    -> (forall a. Ord a => PrimitiveGuard a -> a)
    -> (forall a. Ord a => PrimitiveGuard a -> a)
    -> (forall a. Num a => PrimitiveGuard a -> a)
    -> (forall a. Num a => PrimitiveGuard a -> a)
    -> Foldable PrimitiveGuard
    forall a. Eq a => a -> PrimitiveGuard a -> Bool
    forall a. Num a => PrimitiveGuard a -> a
    forall a. Ord a => PrimitiveGuard a -> a
    forall m. Monoid m => PrimitiveGuard m -> m
    forall a. PrimitiveGuard a -> Bool
    forall a. PrimitiveGuard a -> Int
    forall a. PrimitiveGuard a -> [a]
    forall a. (a -> a -> a) -> PrimitiveGuard a -> a
    forall m a. Monoid m => (a -> m) -> PrimitiveGuard a -> m
    forall b a. (b -> a -> b) -> b -> PrimitiveGuard a -> b
    forall a b. (a -> b -> b) -> b -> PrimitiveGuard a -> b
    forall (t :: Type -> Type).
    (forall m. Monoid m => t m -> m)
    -> (forall m a. Monoid m => (a -> m) -> t a -> m)
    -> (forall m a. Monoid m => (a -> m) -> t a -> m)
    -> (forall a b. (a -> b -> b) -> b -> t a -> b)
    -> (forall a b. (a -> b -> b) -> b -> t a -> b)
    -> (forall b a. (b -> a -> b) -> b -> t a -> b)
    -> (forall b a. (b -> a -> b) -> b -> t a -> b)
    -> (forall a. (a -> a -> a) -> t a -> a)
    -> (forall a. (a -> a -> a) -> t a -> a)
    -> (forall a. t a -> [a])
    -> (forall a. t a -> Bool)
    -> (forall a. t a -> Int)
    -> (forall a. Eq a => a -> t a -> Bool)
    -> (forall a. Ord a => t a -> a)
    -> (forall a. Ord a => t a -> a)
    -> (forall a. Num a => t a -> a)
    -> (forall a. Num a => t a -> a)
    -> Foldable t
    $cfold :: forall m. Monoid m => PrimitiveGuard m -> m
    fold :: forall m. Monoid m => PrimitiveGuard m -> m
    $cfoldMap :: forall m a. Monoid m => (a -> m) -> PrimitiveGuard a -> m
    foldMap :: forall m a. Monoid m => (a -> m) -> PrimitiveGuard a -> m
    $cfoldMap' :: forall m a. Monoid m => (a -> m) -> PrimitiveGuard a -> m
    foldMap' :: forall m a. Monoid m => (a -> m) -> PrimitiveGuard a -> m
    $cfoldr :: forall a b. (a -> b -> b) -> b -> PrimitiveGuard a -> b
    foldr :: forall a b. (a -> b -> b) -> b -> PrimitiveGuard a -> b
    $cfoldr' :: forall a b. (a -> b -> b) -> b -> PrimitiveGuard a -> b
    foldr' :: forall a b. (a -> b -> b) -> b -> PrimitiveGuard a -> b
    $cfoldl :: forall b a. (b -> a -> b) -> b -> PrimitiveGuard a -> b
    foldl :: forall b a. (b -> a -> b) -> b -> PrimitiveGuard a -> b
    $cfoldl' :: forall b a. (b -> a -> b) -> b -> PrimitiveGuard a -> b
    foldl' :: forall b a. (b -> a -> b) -> b -> PrimitiveGuard a -> b
    $cfoldr1 :: forall a. (a -> a -> a) -> PrimitiveGuard a -> a
    foldr1 :: forall a. (a -> a -> a) -> PrimitiveGuard a -> a
    $cfoldl1 :: forall a. (a -> a -> a) -> PrimitiveGuard a -> a
    foldl1 :: forall a. (a -> a -> a) -> PrimitiveGuard a -> a
    $ctoList :: forall a. PrimitiveGuard a -> [a]
    toList :: forall a. PrimitiveGuard a -> [a]
    $cnull :: forall a. PrimitiveGuard a -> Bool
    null :: forall a. PrimitiveGuard a -> Bool
    $clength :: forall a. PrimitiveGuard a -> Int
    length :: forall a. PrimitiveGuard a -> Int
    $celem :: forall a. Eq a => a -> PrimitiveGuard a -> Bool
    elem :: forall a. Eq a => a -> PrimitiveGuard a -> Bool
    $cmaximum :: forall a. Ord a => PrimitiveGuard a -> a
    maximum :: forall a. Ord a => PrimitiveGuard a -> a
    $cminimum :: forall a. Ord a => PrimitiveGuard a -> a
    minimum :: forall a. Ord a => PrimitiveGuard a -> a
    $csum :: forall a. Num a => PrimitiveGuard a -> a
    sum :: forall a. Num a => PrimitiveGuard a -> a
    $cproduct :: forall a. Num a => PrimitiveGuard a -> a
    product :: forall a. Num a => PrimitiveGuard a -> a
    Foldable
        , Functor PrimitiveGuard
    Foldable PrimitiveGuard
    (Functor PrimitiveGuard, Foldable PrimitiveGuard) =>
    (forall (f :: Type -> Type) a b.
     Applicative f =>
     (a -> f b) -> PrimitiveGuard a -> f (PrimitiveGuard b))
    -> (forall (f :: Type -> Type) a.
        Applicative f =>
        PrimitiveGuard (f a) -> f (PrimitiveGuard a))
    -> (forall (m :: Type -> Type) a b.
        Monad m =>
        (a -> m b) -> PrimitiveGuard a -> m (PrimitiveGuard b))
    -> (forall (m :: Type -> Type) a.
        Monad m =>
        PrimitiveGuard (m a) -> m (PrimitiveGuard a))
    -> Traversable PrimitiveGuard
    forall (t :: Type -> Type).
    (Functor t, Foldable t) =>
    (forall (f :: Type -> Type) a b.
     Applicative f =>
     (a -> f b) -> t a -> f (t b))
    -> (forall (f :: Type -> Type) a.
        Applicative f =>
        t (f a) -> f (t a))
    -> (forall (m :: Type -> Type) a b.
        Monad m =>
        (a -> m b) -> t a -> m (t b))
    -> (forall (m :: Type -> Type) a. Monad m => t (m a) -> m (t a))
    -> Traversable t
    forall (m :: Type -> Type) a.
    Monad m =>
    PrimitiveGuard (m a) -> m (PrimitiveGuard a)
    forall (f :: Type -> Type) a.
    Applicative f =>
    PrimitiveGuard (f a) -> f (PrimitiveGuard a)
    forall (m :: Type -> Type) a b.
    Monad m =>
    (a -> m b) -> PrimitiveGuard a -> m (PrimitiveGuard b)
    forall (f :: Type -> Type) a b.
    Applicative f =>
    (a -> f b) -> PrimitiveGuard a -> f (PrimitiveGuard b)
    $ctraverse :: forall (f :: Type -> Type) a b.
    Applicative f =>
    (a -> f b) -> PrimitiveGuard a -> f (PrimitiveGuard b)
    traverse :: forall (f :: Type -> Type) a b.
    Applicative f =>
    (a -> f b) -> PrimitiveGuard a -> f (PrimitiveGuard b)
    $csequenceA :: forall (f :: Type -> Type) a.
    Applicative f =>
    PrimitiveGuard (f a) -> f (PrimitiveGuard a)
    sequenceA :: forall (f :: Type -> Type) a.
    Applicative f =>
    PrimitiveGuard (f a) -> f (PrimitiveGuard a)
    $cmapM :: forall (m :: Type -> Type) a b.
    Monad m =>
    (a -> m b) -> PrimitiveGuard a -> m (PrimitiveGuard b)
    mapM :: forall (m :: Type -> Type) a b.
    Monad m =>
    (a -> m b) -> PrimitiveGuard a -> m (PrimitiveGuard b)
    $csequence :: forall (m :: Type -> Type) a.
    Monad m =>
    PrimitiveGuard (m a) -> m (PrimitiveGuard a)
    sequence :: forall (m :: Type -> Type) a.
    Monad m =>
    PrimitiveGuard (m a) -> m (PrimitiveGuard a)
    Traversable, Get (PrimitiveGuard a)
    [PrimitiveGuard a] -> Put
    PrimitiveGuard a -> Put
    (PrimitiveGuard a -> Put)
    -> Get (PrimitiveGuard a)
    -> ([PrimitiveGuard a] -> Put)
    -> Binary (PrimitiveGuard a)
    forall a. Binary a => Get (PrimitiveGuard a)
    forall a. Binary a => [PrimitiveGuard a] -> Put
    forall a. Binary a => PrimitiveGuard a -> Put
    forall t. (t -> Put) -> Get t -> ([t] -> Put) -> Binary t
    $cput :: forall a. Binary a => PrimitiveGuard a -> Put
    put :: PrimitiveGuard a -> Put
    $cget :: forall a. Binary a => Get (PrimitiveGuard a)
    get :: Get (PrimitiveGuard a)
    $cputList :: forall a. Binary a => [PrimitiveGuard a] -> Put
    putList :: [PrimitiveGuard a] -> Put
    Binary, PrimitiveGuard a -> PrimitiveGuard a -> Bool
    (PrimitiveGuard a -> PrimitiveGuard a -> Bool)
    -> (PrimitiveGuard a -> PrimitiveGuard a -> Bool)
    -> Eq (PrimitiveGuard a)
    forall a. Eq a => PrimitiveGuard a -> PrimitiveGuard a -> Bool
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: forall a. Eq a => PrimitiveGuard a -> PrimitiveGuard a -> Bool
    == :: PrimitiveGuard a -> PrimitiveGuard a -> Bool
    $c/= :: forall a. Eq a => PrimitiveGuard a -> PrimitiveGuard a -> Bool
    /= :: PrimitiveGuard a -> PrimitiveGuard a -> Bool
    Eq )

    -- | Warning that will be emitted on instantiating a guarded value.
    data PrimitiveWarning
      = WarnNonSynthesizable String
      -- ^ Marks value as non-synthesizable. This will trigger a warning if
      -- instantiated in a non-testbench context.
      | WarnAlways String
      -- ^ Always emit warning upon primitive instantiation.
        deriving (Int -> PrimitiveWarning -> ShowS
    [PrimitiveWarning] -> ShowS
    PrimitiveWarning -> String
    (Int -> PrimitiveWarning -> ShowS)
    -> (PrimitiveWarning -> String)
    -> ([PrimitiveWarning] -> ShowS)
    -> Show PrimitiveWarning
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> PrimitiveWarning -> ShowS
    showsPrec :: Int -> PrimitiveWarning -> ShowS
    $cshow :: PrimitiveWarning -> String
    show :: PrimitiveWarning -> String
    $cshowList :: [PrimitiveWarning] -> ShowS
    showList :: [PrimitiveWarning] -> ShowS
    Show, ReadPrec [PrimitiveWarning]
    ReadPrec PrimitiveWarning
    Int -> ReadS PrimitiveWarning
    ReadS [PrimitiveWarning]
    (Int -> ReadS PrimitiveWarning)
    -> ReadS [PrimitiveWarning]
    -> ReadPrec PrimitiveWarning
    -> ReadPrec [PrimitiveWarning]
    -> Read PrimitiveWarning
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS PrimitiveWarning
    readsPrec :: Int -> ReadS PrimitiveWarning
    $creadList :: ReadS [PrimitiveWarning]
    readList :: ReadS [PrimitiveWarning]
    $creadPrec :: ReadPrec PrimitiveWarning
    readPrec :: ReadPrec PrimitiveWarning
    $creadListPrec :: ReadPrec [PrimitiveWarning]
    readListPrec :: ReadPrec [PrimitiveWarning]
    Read, Typeable PrimitiveWarning
    Typeable PrimitiveWarning =>
    (forall (c :: Type -> Type).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> PrimitiveWarning -> c PrimitiveWarning)
    -> (forall (c :: Type -> Type).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c PrimitiveWarning)
    -> (PrimitiveWarning -> Constr)
    -> (PrimitiveWarning -> DataType)
    -> (forall (t :: Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c PrimitiveWarning))
    -> (forall (t :: Type -> Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c PrimitiveWarning))
    -> ((forall b. Data b => b -> b)
        -> PrimitiveWarning -> PrimitiveWarning)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> PrimitiveWarning -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> PrimitiveWarning -> r)
    -> (forall u.
        (forall d. Data d => d -> u) -> PrimitiveWarning -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> PrimitiveWarning -> u)
    -> (forall (m :: Type -> Type).
        Monad m =>
        (forall d. Data d => d -> m d)
        -> PrimitiveWarning -> m PrimitiveWarning)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d)
        -> PrimitiveWarning -> m PrimitiveWarning)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d)
        -> PrimitiveWarning -> m PrimitiveWarning)
    -> Data PrimitiveWarning
    PrimitiveWarning -> Constr
    PrimitiveWarning -> DataType
    (forall b. Data b => b -> b)
    -> PrimitiveWarning -> PrimitiveWarning
    forall a.
    Typeable a =>
    (forall (c :: Type -> Type).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: Type -> Type).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: Type -> Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: Type -> Type).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u.
    Int -> (forall d. Data d => d -> u) -> PrimitiveWarning -> u
    forall u. (forall d. Data d => d -> u) -> PrimitiveWarning -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> PrimitiveWarning -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> PrimitiveWarning -> r
    forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> PrimitiveWarning -> m PrimitiveWarning
    forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> PrimitiveWarning -> m PrimitiveWarning
    forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c PrimitiveWarning
    forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> PrimitiveWarning -> c PrimitiveWarning
    forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c PrimitiveWarning)
    forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c PrimitiveWarning)
    $cgfoldl :: forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> PrimitiveWarning -> c PrimitiveWarning
    gfoldl :: forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> PrimitiveWarning -> c PrimitiveWarning
    $cgunfold :: forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c PrimitiveWarning
    gunfold :: forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c PrimitiveWarning
    $ctoConstr :: PrimitiveWarning -> Constr
    toConstr :: PrimitiveWarning -> Constr
    $cdataTypeOf :: PrimitiveWarning -> DataType
    dataTypeOf :: PrimitiveWarning -> DataType
    $cdataCast1 :: forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c PrimitiveWarning)
    dataCast1 :: forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c PrimitiveWarning)
    $cdataCast2 :: forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c PrimitiveWarning)
    dataCast2 :: forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c PrimitiveWarning)
    $cgmapT :: (forall b. Data b => b -> b)
    -> PrimitiveWarning -> PrimitiveWarning
    gmapT :: (forall b. Data b => b -> b)
    -> PrimitiveWarning -> PrimitiveWarning
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> PrimitiveWarning -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> PrimitiveWarning -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> PrimitiveWarning -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> PrimitiveWarning -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> PrimitiveWarning -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> PrimitiveWarning -> [u]
    $cgmapQi :: forall u.
    Int -> (forall d. Data d => d -> u) -> PrimitiveWarning -> u
    gmapQi :: forall u.
    Int -> (forall d. Data d => d -> u) -> PrimitiveWarning -> u
    $cgmapM :: forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> PrimitiveWarning -> m PrimitiveWarning
    gmapM :: forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> PrimitiveWarning -> m PrimitiveWarning
    $cgmapMp :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> PrimitiveWarning -> m PrimitiveWarning
    gmapMp :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> PrimitiveWarning -> m PrimitiveWarning
    $cgmapMo :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> PrimitiveWarning -> m PrimitiveWarning
    gmapMo :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> PrimitiveWarning -> m PrimitiveWarning
    Data, (forall x. PrimitiveWarning -> Rep PrimitiveWarning x)
    -> (forall x. Rep PrimitiveWarning x -> PrimitiveWarning)
    -> Generic PrimitiveWarning
    forall x. Rep PrimitiveWarning x -> PrimitiveWarning
    forall x. PrimitiveWarning -> Rep PrimitiveWarning x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. PrimitiveWarning -> Rep PrimitiveWarning x
    from :: forall x. PrimitiveWarning -> Rep PrimitiveWarning x
    $cto :: forall x. Rep PrimitiveWarning x -> PrimitiveWarning
    to :: forall x. Rep PrimitiveWarning x -> PrimitiveWarning
    Generic, PrimitiveWarning -> ()
    (PrimitiveWarning -> ()) -> NFData PrimitiveWarning
    forall a. (a -> ()) -> NFData a
    $crnf :: PrimitiveWarning -> ()
    rnf :: PrimitiveWarning -> ()
    NFData, Eq PrimitiveWarning
    Eq PrimitiveWarning =>
    (Int -> PrimitiveWarning -> Int)
    -> (PrimitiveWarning -> Int) -> Hashable PrimitiveWarning
    Int -> PrimitiveWarning -> Int
    PrimitiveWarning -> Int
    forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
    $chashWithSalt :: Int -> PrimitiveWarning -> Int
    hashWithSalt :: Int -> PrimitiveWarning -> Int
    $chash :: PrimitiveWarning -> Int
    hash :: PrimitiveWarning -> Int
    Hashable, Get PrimitiveWarning
    [PrimitiveWarning] -> Put
    PrimitiveWarning -> Put
    (PrimitiveWarning -> Put)
    -> Get PrimitiveWarning
    -> ([PrimitiveWarning] -> Put)
    -> Binary PrimitiveWarning
    forall t. (t -> Put) -> Get t -> ([t] -> Put) -> Binary t
    $cput :: PrimitiveWarning -> Put
    put :: PrimitiveWarning -> Put
    $cget :: Get PrimitiveWarning
    get :: Get PrimitiveWarning
    $cputList :: [PrimitiveWarning] -> Put
    putList :: [PrimitiveWarning] -> Put
    Binary, PrimitiveWarning -> PrimitiveWarning -> Bool
    (PrimitiveWarning -> PrimitiveWarning -> Bool)
    -> (PrimitiveWarning -> PrimitiveWarning -> Bool)
    -> Eq PrimitiveWarning
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: PrimitiveWarning -> PrimitiveWarning -> Bool
    == :: PrimitiveWarning -> PrimitiveWarning -> Bool
    $c/= :: PrimitiveWarning -> PrimitiveWarning -> Bool
    /= :: PrimitiveWarning -> PrimitiveWarning -> Bool
    Eq)

    -- | Extract primitive definition from a PrimitiveGuard. Will yield Nothing
    -- for guards of value 'DontTranslate'.
    extractPrim
      :: PrimitiveGuard a
      -> Maybe a
    extractPrim :: forall a. PrimitiveGuard a -> Maybe a
    extractPrim =
      \case
        HasBlackBox [PrimitiveWarning]
    _ a
    p -> a -> Maybe a
    forall a. a -> Maybe a
    Just a
    p
        PrimitiveGuard a
    DontTranslate   -> Maybe a
    forall a. Maybe a
    Nothing

    -- | Extract primitive warnings from a PrimitiveGuard. Will yield an empty list
    -- for guards of value 'DontTranslate'.
    extractWarnings
      :: PrimitiveGuard a
      -> [PrimitiveWarning]
    extractWarnings :: forall a. PrimitiveGuard a -> [PrimitiveWarning]
    extractWarnings =
      \case
        HasBlackBox [PrimitiveWarning]
    w a
    _ -> [PrimitiveWarning]
    w
        PrimitiveGuard a
    DontTranslate   -> []