hs-bindgen-1.0.0.0: test-artefacts/fixtures/macros/parse/intermittent_include.1.empty/Example.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE UndecidableInstances #-}
module Example
( Example.Ta(..)
, Example.T1(..)
, Example.T2(..)
)
where
import qualified HsBindgen.Runtime.HasCField as HasCField
import qualified HsBindgen.Runtime.Marshal as Marshal
import qualified HsBindgen.Runtime.Support as BG
import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
{-| __C declaration:__ @Ta@
__defined at:__ @intermittent_include_inner.h 3:13@
__exported by:__ @macros\/parse\/intermittent_include.h@
-}
newtype Ta = Ta
{ unwrapTa :: BG.CInt
}
deriving stock (Eq, BG.Generic, Ord, Read, Show)
deriving newtype
( BG.Bitfield
, BG.Bits
, Bounded
, Enum
, BG.FiniteBits
, BG.HasFFIType
, Integral
, BG.Ix
, Num
, BG.Prim
, Marshal.ReadRaw
, Real
, Marshal.StaticSize
, BG.Storable
, Marshal.WriteRaw
)
instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapTa" Ta ty where
hasField =
\x0 ->
(\y1 ->
Ta {unwrapTa = y1}, BG.getField @"unwrapTa" x0)
instance (ty ~ BG.CInt) => BG.HasField "unwrapTa" (BG.Ptr Ta) (BG.Ptr ty) where
getField = HasCField.fromPtr (BG.Proxy @"unwrapTa")
instance HasCField.HasCField Ta "unwrapTa" where
type CFieldType Ta "unwrapTa" = BG.CInt
offset# = \_ -> \_ -> 0
{-| __C declaration:__ @T1@
__defined at:__ @macros\/parse\/intermittent_include.h 9:13@
__exported by:__ @macros\/parse\/intermittent_include.h@
-}
newtype T1 = T1
{ unwrapT1 :: BG.CInt
}
deriving stock (Eq, BG.Generic, Ord, Read, Show)
deriving newtype
( BG.Bitfield
, BG.Bits
, Bounded
, Enum
, BG.FiniteBits
, BG.HasFFIType
, Integral
, BG.Ix
, Num
, BG.Prim
, Marshal.ReadRaw
, Real
, Marshal.StaticSize
, BG.Storable
, Marshal.WriteRaw
)
instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT1" T1 ty where
hasField =
\x0 ->
(\y1 ->
T1 {unwrapT1 = y1}, BG.getField @"unwrapT1" x0)
instance (ty ~ BG.CInt) => BG.HasField "unwrapT1" (BG.Ptr T1) (BG.Ptr ty) where
getField = HasCField.fromPtr (BG.Proxy @"unwrapT1")
instance HasCField.HasCField T1 "unwrapT1" where
type CFieldType T1 "unwrapT1" = BG.CInt
offset# = \_ -> \_ -> 0
{-| __C declaration:__ @T2@
__defined at:__ @macros\/parse\/intermittent_include.h 17:13@
__exported by:__ @macros\/parse\/intermittent_include.h@
-}
newtype T2 = T2
{ unwrapT2 :: BG.CInt
}
deriving stock (Eq, BG.Generic, Ord, Read, Show)
deriving newtype
( BG.Bitfield
, BG.Bits
, Bounded
, Enum
, BG.FiniteBits
, BG.HasFFIType
, Integral
, BG.Ix
, Num
, BG.Prim
, Marshal.ReadRaw
, Real
, Marshal.StaticSize
, BG.Storable
, Marshal.WriteRaw
)
instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT2" T2 ty where
hasField =
\x0 ->
(\y1 ->
T2 {unwrapT2 = y1}, BG.getField @"unwrapT2" x0)
instance (ty ~ BG.CInt) => BG.HasField "unwrapT2" (BG.Ptr T2) (BG.Ptr ty) where
getField = HasCField.fromPtr (BG.Proxy @"unwrapT2")
instance HasCField.HasCField T2 "unwrapT2" where
type CFieldType T2 "unwrapT2" = BG.CInt
offset# = \_ -> \_ -> 0