{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -Wno-unused-imports #-}
{-# OPTIONS_GHC -fno-omit-interface-pragmas #-}
{-# OPTIONS_GHC -fmax-simplifier-iterations=0 #-}
module PlutusTx.Prelude (
module Eq,
module Enum,
module Ord,
module Semigroup,
module Monoid,
module Numeric,
module Functor,
module Applicative,
module Lattice,
module Foldable,
module Traversable,
(Haskell.>>=),
(Haskell.=<<),
(Haskell.>>),
Haskell.return,
module Base,
module Trace,
BuiltinString,
appendString,
emptyString,
equalsString,
encodeUtf8,
error,
check,
module Bool,
Integer,
divide,
modulo,
quotient,
remainder,
even,
module Maybe,
module Either,
module List,
BuiltinByteString,
appendByteString,
consByteString,
takeByteString,
dropByteString,
sliceByteString,
lengthOfByteString,
indexByteString,
emptyByteString,
decodeUtf8,
sha2_256,
sha3_256,
verifyEd25519Signature,
verifyEcdsaSecp256k1Signature,
verifySchnorrSecp256k1Signature,
Rational,
unsafeRatio,
ratio,
fromInteger,
round,
BuiltinData,
fromBuiltin,
toBuiltin
) where
import Data.String (IsString (..))
import PlutusCore.Data (Data (..))
import PlutusTx.Applicative as Applicative
import PlutusTx.Base as Base
import PlutusTx.Bool as Bool
import PlutusTx.Builtins (BuiltinByteString, BuiltinData, BuiltinString, Integer, appendByteString, appendString,
consByteString, decodeUtf8, emptyByteString, emptyString, encodeUtf8, equalsByteString,
equalsString, error, fromBuiltin, greaterThanByteString, indexByteString, lengthOfByteString,
lessThanByteString, sha2_256, sha3_256, sliceByteString, toBuiltin, trace,
verifyEcdsaSecp256k1Signature, verifyEd25519Signature, verifySchnorrSecp256k1Signature)
import PlutusTx.Builtins qualified as Builtins
import PlutusTx.Either as Either
import PlutusTx.Enum as Enum
import PlutusTx.Eq as Eq
import PlutusTx.ErrorCodes
import PlutusTx.Foldable as Foldable
import PlutusTx.Functor as Functor
import PlutusTx.IsData
import PlutusTx.Lattice as Lattice
import PlutusTx.List as List hiding (foldr)
import PlutusTx.Maybe as Maybe
import PlutusTx.Monoid as Monoid
import PlutusTx.Numeric as Numeric
import PlutusTx.Ord as Ord
import PlutusTx.Ratio as Ratio
import PlutusTx.Semigroup as Semigroup
import PlutusTx.Trace as Trace
import PlutusTx.Traversable as Traversable
import Prelude qualified as Haskell (return, (=<<), (>>), (>>=))
{-# INLINABLE check #-}
check :: Bool -> ()
check :: Bool -> ()
check Bool
b = if Bool
b then () else BuiltinString -> ()
forall a. BuiltinString -> a
traceError BuiltinString
checkHasFailedError
{-# INLINABLE divide #-}
divide :: Integer -> Integer -> Integer
divide :: Integer -> Integer -> Integer
divide = Integer -> Integer -> Integer
Builtins.divideInteger
{-# INLINABLE modulo #-}
modulo :: Integer -> Integer -> Integer
modulo :: Integer -> Integer -> Integer
modulo = Integer -> Integer -> Integer
Builtins.modInteger
{-# INLINABLE quotient #-}
quotient :: Integer -> Integer -> Integer
quotient :: Integer -> Integer -> Integer
quotient = Integer -> Integer -> Integer
Builtins.quotientInteger
{-# INLINABLE remainder #-}
remainder :: Integer -> Integer -> Integer
remainder :: Integer -> Integer -> Integer
remainder = Integer -> Integer -> Integer
Builtins.remainderInteger
{-# INLINABLE even #-}
even :: Integer -> Bool
even :: Integer -> Bool
even Integer
n = if Integer -> Integer -> Integer
modulo Integer
n Integer
2 Integer -> Integer -> Bool
forall a. Eq a => a -> a -> Bool
== Integer
0 then Bool
True else Bool
False
{-# INLINABLE takeByteString #-}
takeByteString :: Integer -> BuiltinByteString -> BuiltinByteString
takeByteString :: Integer -> BuiltinByteString -> BuiltinByteString
takeByteString Integer
n BuiltinByteString
bs = Integer -> Integer -> BuiltinByteString -> BuiltinByteString
Builtins.sliceByteString Integer
0 (Integer -> Integer
forall a arep. ToBuiltin a arep => a -> arep
toBuiltin Integer
n) BuiltinByteString
bs
{-# INLINABLE dropByteString #-}
dropByteString :: Integer -> BuiltinByteString -> BuiltinByteString
dropByteString :: Integer -> BuiltinByteString -> BuiltinByteString
dropByteString Integer
n BuiltinByteString
bs = Integer -> Integer -> BuiltinByteString -> BuiltinByteString
Builtins.sliceByteString (Integer -> Integer
forall a arep. ToBuiltin a arep => a -> arep
toBuiltin Integer
n) (BuiltinByteString -> Integer
Builtins.lengthOfByteString BuiltinByteString
bs Integer -> Integer -> Integer
forall a. AdditiveGroup a => a -> a -> a
- Integer
n) BuiltinByteString
bs