module PlutusTx.Base (fst, snd, curry, uncurry, ($), flip, until, (.), const, id) where
import PlutusTx.Bool
{-# INLINABLE fst #-}
fst :: (a, b) -> a
fst :: (a, b) -> a
fst (a
a, b
_) = a
a
{-# INLINABLE snd #-}
snd :: (a, b) -> b
snd :: (a, b) -> b
snd (a
_, b
b) = b
b
{-# INLINABLE curry #-}
curry :: ((a, b) -> c) -> a -> b -> c
curry :: ((a, b) -> c) -> a -> b -> c
curry (a, b) -> c
f a
a b
b = (a, b) -> c
f (a
a, b
b)
{-# INLINABLE uncurry #-}
uncurry :: (a -> b -> c) -> (a, b) -> c
uncurry :: (a -> b -> c) -> (a, b) -> c
uncurry a -> b -> c
f (a
a, b
b) = a -> b -> c
f a
a b
b
infixr 0 $
{-# INLINABLE ($) #-}
($) :: (a -> b) -> a -> b
a -> b
f $ :: (a -> b) -> a -> b
$ a
a = a -> b
f a
a
{-# INLINABLE flip #-}
flip :: (a -> b -> c) -> b -> a -> c
flip :: (a -> b -> c) -> b -> a -> c
flip a -> b -> c
f b
x a
y = a -> b -> c
f a
y b
x
{-# INLINABLE until #-}
until :: (a -> Bool) -> (a -> a) -> a -> a
until :: (a -> Bool) -> (a -> a) -> a -> a
until a -> Bool
p a -> a
f = a -> a
go
where
go :: a -> a
go a
x | a -> Bool
p a
x = a
x
| Bool
otherwise = a -> a
go (a -> a
f a
x)
infixr 9 .
{-# INLINABLE (.) #-}
(.) :: (b -> c) -> (a -> b) -> a -> c
. :: (b -> c) -> (a -> b) -> a -> c
(.) b -> c
f a -> b
g = \a
x -> b -> c
f (a -> b
g a
x)
{-# INLINABLE const #-}
const :: a -> b -> a
const :: a -> b -> a
const a
x b
_ = a
x
{-# INLINABLE id #-}
id :: a -> a
id :: a -> a
id a
x = a
x