{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE Safe #-}
module Cryptol.TypeCheck.FFI.FFIType where
import Control.DeepSeq
import GHC.Generics
import Cryptol.TypeCheck.Type
import Cryptol.Utils.Ident
import Cryptol.Utils.RecordMap
data FFIFunType = FFIFunType
{
FFIFunType -> [TParam]
ffiTParams :: [TParam]
, FFIFunType -> [FFIType]
ffiArgTypes :: [FFIType]
, FFIFunType -> FFIType
ffiRetType :: FFIType }
deriving (Int -> FFIFunType -> ShowS
[FFIFunType] -> ShowS
FFIFunType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FFIFunType] -> ShowS
$cshowList :: [FFIFunType] -> ShowS
show :: FFIFunType -> String
$cshow :: FFIFunType -> String
showsPrec :: Int -> FFIFunType -> ShowS
$cshowsPrec :: Int -> FFIFunType -> ShowS
Show, forall x. Rep FFIFunType x -> FFIFunType
forall x. FFIFunType -> Rep FFIFunType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FFIFunType x -> FFIFunType
$cfrom :: forall x. FFIFunType -> Rep FFIFunType x
Generic, FFIFunType -> ()
forall a. (a -> ()) -> NFData a
rnf :: FFIFunType -> ()
$crnf :: FFIFunType -> ()
NFData)
data FFIType
= FFIBool
| FFIBasic FFIBasicType
| FFIArray [Type] FFIBasicType
| FFITuple [FFIType]
| FFIRecord (RecordMap Ident FFIType)
deriving (Int -> FFIType -> ShowS
[FFIType] -> ShowS
FFIType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FFIType] -> ShowS
$cshowList :: [FFIType] -> ShowS
show :: FFIType -> String
$cshow :: FFIType -> String
showsPrec :: Int -> FFIType -> ShowS
$cshowsPrec :: Int -> FFIType -> ShowS
Show, forall x. Rep FFIType x -> FFIType
forall x. FFIType -> Rep FFIType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FFIType x -> FFIType
$cfrom :: forall x. FFIType -> Rep FFIType x
Generic, FFIType -> ()
forall a. (a -> ()) -> NFData a
rnf :: FFIType -> ()
$crnf :: FFIType -> ()
NFData)
data FFIBasicType
= FFIBasicVal FFIBasicValType
| FFIBasicRef FFIBasicRefType
deriving (Int -> FFIBasicType -> ShowS
[FFIBasicType] -> ShowS
FFIBasicType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FFIBasicType] -> ShowS
$cshowList :: [FFIBasicType] -> ShowS
show :: FFIBasicType -> String
$cshow :: FFIBasicType -> String
showsPrec :: Int -> FFIBasicType -> ShowS
$cshowsPrec :: Int -> FFIBasicType -> ShowS
Show, forall x. Rep FFIBasicType x -> FFIBasicType
forall x. FFIBasicType -> Rep FFIBasicType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FFIBasicType x -> FFIBasicType
$cfrom :: forall x. FFIBasicType -> Rep FFIBasicType x
Generic, FFIBasicType -> ()
forall a. (a -> ()) -> NFData a
rnf :: FFIBasicType -> ()
$crnf :: FFIBasicType -> ()
NFData)
data FFIBasicValType
= FFIWord
Integer
FFIWordSize
| FFIFloat
Integer
Integer
FFIFloatSize
deriving (Int -> FFIBasicValType -> ShowS
[FFIBasicValType] -> ShowS
FFIBasicValType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FFIBasicValType] -> ShowS
$cshowList :: [FFIBasicValType] -> ShowS
show :: FFIBasicValType -> String
$cshow :: FFIBasicValType -> String
showsPrec :: Int -> FFIBasicValType -> ShowS
$cshowsPrec :: Int -> FFIBasicValType -> ShowS
Show, forall x. Rep FFIBasicValType x -> FFIBasicValType
forall x. FFIBasicValType -> Rep FFIBasicValType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FFIBasicValType x -> FFIBasicValType
$cfrom :: forall x. FFIBasicValType -> Rep FFIBasicValType x
Generic, FFIBasicValType -> ()
forall a. (a -> ()) -> NFData a
rnf :: FFIBasicValType -> ()
$crnf :: FFIBasicValType -> ()
NFData)
data FFIWordSize
= FFIWord8
| FFIWord16
| FFIWord32
| FFIWord64
deriving (Int -> FFIWordSize -> ShowS
[FFIWordSize] -> ShowS
FFIWordSize -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FFIWordSize] -> ShowS
$cshowList :: [FFIWordSize] -> ShowS
show :: FFIWordSize -> String
$cshow :: FFIWordSize -> String
showsPrec :: Int -> FFIWordSize -> ShowS
$cshowsPrec :: Int -> FFIWordSize -> ShowS
Show, forall x. Rep FFIWordSize x -> FFIWordSize
forall x. FFIWordSize -> Rep FFIWordSize x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FFIWordSize x -> FFIWordSize
$cfrom :: forall x. FFIWordSize -> Rep FFIWordSize x
Generic, FFIWordSize -> ()
forall a. (a -> ()) -> NFData a
rnf :: FFIWordSize -> ()
$crnf :: FFIWordSize -> ()
NFData)
data FFIFloatSize
= FFIFloat32
| FFIFloat64
deriving (Int -> FFIFloatSize -> ShowS
[FFIFloatSize] -> ShowS
FFIFloatSize -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FFIFloatSize] -> ShowS
$cshowList :: [FFIFloatSize] -> ShowS
show :: FFIFloatSize -> String
$cshow :: FFIFloatSize -> String
showsPrec :: Int -> FFIFloatSize -> ShowS
$cshowsPrec :: Int -> FFIFloatSize -> ShowS
Show, forall x. Rep FFIFloatSize x -> FFIFloatSize
forall x. FFIFloatSize -> Rep FFIFloatSize x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FFIFloatSize x -> FFIFloatSize
$cfrom :: forall x. FFIFloatSize -> Rep FFIFloatSize x
Generic, FFIFloatSize -> ()
forall a. (a -> ()) -> NFData a
rnf :: FFIFloatSize -> ()
$crnf :: FFIFloatSize -> ()
NFData)
data FFIBasicRefType
= FFIInteger
(Maybe Type)
| FFIRational
deriving (Int -> FFIBasicRefType -> ShowS
[FFIBasicRefType] -> ShowS
FFIBasicRefType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FFIBasicRefType] -> ShowS
$cshowList :: [FFIBasicRefType] -> ShowS
show :: FFIBasicRefType -> String
$cshow :: FFIBasicRefType -> String
showsPrec :: Int -> FFIBasicRefType -> ShowS
$cshowsPrec :: Int -> FFIBasicRefType -> ShowS
Show, forall x. Rep FFIBasicRefType x -> FFIBasicRefType
forall x. FFIBasicRefType -> Rep FFIBasicRefType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FFIBasicRefType x -> FFIBasicRefType
$cfrom :: forall x. FFIBasicRefType -> Rep FFIBasicRefType x
Generic, FFIBasicRefType -> ()
forall a. (a -> ()) -> NFData a
rnf :: FFIBasicRefType -> ()
$crnf :: FFIBasicRefType -> ()
NFData)