unison-runtime-0.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Unison.Runtime.Stack

Synopsis

Documentation

data K Source #

Instances

Instances details
Show K Source # 
Instance details

Defined in Unison.Runtime.Stack

Methods

showsPrec :: Int -> K -> ShowS #

show :: K -> String #

showList :: [K] -> ShowS #

data GClosure comb Source #

Instances

Instances details
Foldable GClosure Source # 
Instance details

Defined in Unison.Runtime.Stack

Methods

fold :: Monoid m => GClosure m -> m #

foldMap :: Monoid m => (a -> m) -> GClosure a -> m #

foldMap' :: Monoid m => (a -> m) -> GClosure a -> m #

foldr :: (a -> b -> b) -> b -> GClosure a -> b #

foldr' :: (a -> b -> b) -> b -> GClosure a -> b #

foldl :: (b -> a -> b) -> b -> GClosure a -> b #

foldl' :: (b -> a -> b) -> b -> GClosure a -> b #

foldr1 :: (a -> a -> a) -> GClosure a -> a #

foldl1 :: (a -> a -> a) -> GClosure a -> a #

toList :: GClosure a -> [a] #

null :: GClosure a -> Bool #

length :: GClosure a -> Int #

elem :: Eq a => a -> GClosure a -> Bool #

maximum :: Ord a => GClosure a -> a #

minimum :: Ord a => GClosure a -> a #

sum :: Num a => GClosure a -> a #

product :: Num a => GClosure a -> a #

Traversable GClosure Source # 
Instance details

Defined in Unison.Runtime.Stack

Methods

traverse :: Applicative f => (a -> f b) -> GClosure a -> f (GClosure b) #

sequenceA :: Applicative f => GClosure (f a) -> f (GClosure a) #

mapM :: Monad m => (a -> m b) -> GClosure a -> m (GClosure b) #

sequence :: Monad m => GClosure (m a) -> m (GClosure a) #

Functor GClosure Source # 
Instance details

Defined in Unison.Runtime.Stack

Methods

fmap :: (a -> b) -> GClosure a -> GClosure b #

(<$) :: a -> GClosure b -> GClosure a #

Show comb => Show (GClosure comb) Source # 
Instance details

Defined in Unison.Runtime.Stack

Methods

showsPrec :: Int -> GClosure comb -> ShowS #

show :: GClosure comb -> String #

showList :: [GClosure comb] -> ShowS #

newtype Closure Source #

Constructors

Closure 

Bundled Patterns

pattern DataC :: Reference -> PackedTag -> SegList -> Closure 
pattern PApV :: CombIx -> RCombInfo Val -> SegList -> Closure 
pattern CapV :: K -> Int -> SegList -> Closure 
pattern PAp :: CombIx -> GCombInfo (RComb Val) -> Seg -> Closure 
pattern Enum :: Reference -> PackedTag -> Closure 
pattern Data1 :: Reference -> PackedTag -> Val -> Closure 
pattern Data2 :: Reference -> PackedTag -> Val -> Val -> Closure 
pattern DataG :: Reference -> PackedTag -> Seg -> Closure 
pattern Captured :: K -> Int -> Seg -> Closure 
pattern Foreign :: Foreign -> Closure 
pattern BlackHole :: Closure 
pattern UnboxedTypeTag :: UnboxedTypeTag -> Closure 

Instances

Instances details
Show Closure Source # 
Instance details

Defined in Unison.Runtime.Stack

newtype Callback Source #

Constructors

Hook (XStack -> IO ()) 

Instances

Instances details
Eq Callback Source # 
Instance details

Defined in Unison.Runtime.Stack

Ord Callback Source # 
Instance details

Defined in Unison.Runtime.Stack

data Augment Source #

Constructors

I 
K 
C 

data Dump Source #

Constructors

A 
F Int Int 
S 

data Stack Source #

Constructors

Stack 

Fields

Instances

Instances details
Show Stack Source # 
Instance details

Defined in Unison.Runtime.Stack

Methods

showsPrec :: Int -> Stack -> ShowS #

show :: Stack -> String #

showList :: [Stack] -> ShowS #

type Off = Int Source #

type SZ = Int Source #

type FP = Int Source #

type Seg = (USeg, BSeg) Source #

type SegList = [Val] Source #

data Val Source #

A runtime value, which is either a boxed or unboxed value, but we may not know which.

Constructors

Val 

Fields

Bundled Patterns

pattern CharVal :: Char -> Val 
pattern NatVal :: Word64 -> Val 
pattern DoubleVal :: Double -> Val 
pattern IntVal :: Int -> Val 
pattern BoolVal :: Bool -> Val 
pattern UnboxedVal :: Int -> UnboxedTypeTag -> Val 
pattern BoxedVal :: Closure -> Val

Matches a Val which is known to be boxed, and returns the closure portion.

Instances

Instances details
Show Val Source # 
Instance details

Defined in Unison.Runtime.Stack

Methods

showsPrec :: Int -> Val -> ShowS #

show :: Val -> String #

showList :: [Val] -> ShowS #

BuiltinForeign (IORef Val) Source # 
Instance details

Defined in Unison.Runtime.Stack

emptyVal :: Val Source #

A nulled out value you can use when filling empty arrays, etc.

boxedVal :: BVal -> Val Source #

Lift a boxed val into an Val

type USeq = Seq Val Source #

Implementation for Unison sequences.

poke :: DebugCallStack => Stack -> Val -> IO () Source #

pokeD :: Stack -> Double -> IO () Source #

pokeOffD :: Stack -> Int -> Double -> IO () Source #

pokeC :: Stack -> Char -> IO () Source #

pokeOffC :: Stack -> Int -> Char -> IO () Source #

pokeBool :: DebugCallStack => Stack -> Bool -> IO () Source #

pokeTag :: DebugCallStack => Stack -> Int -> IO () Source #

Store an unboxed tag to later match on. Often used to indicate the constructor of a data type that's been unpacked onto the stack, or some tag we're about to branch on.

peekTag :: DebugCallStack => Stack -> IO Int Source #

peekTagOff :: DebugCallStack => Stack -> Off -> IO Int Source #

peekI :: DebugCallStack => Stack -> IO Int Source #

peekOffI :: DebugCallStack => Stack -> Off -> IO Int Source #

pokeN :: Stack -> Word64 -> IO () Source #

pokeOffN :: Stack -> Int -> Word64 -> IO () Source #

pokeI :: Stack -> Int -> IO () Source #

Note: This is for poking an unboxed value that has the UNISON type int, not just any unboxed data.

pokeOffI :: Stack -> Int -> Int -> IO () Source #

pokeBi :: BuiltinForeign b => Stack -> b -> IO () Source #

pokeOffBi :: BuiltinForeign b => Stack -> Int -> b -> IO () Source #

pokeS :: Stack -> USeq -> IO () Source #

pokeOffS :: Stack -> Int -> USeq -> IO () Source #

dumpAP :: Int -> Int -> Int -> Dump -> Int Source #

dumpFP :: Int -> Int -> Dump -> Int Source #

peek :: DebugCallStack => Stack -> IO Val Source #

upeek :: DebugCallStack => Stack -> IO UVal Source #

bpeek :: DebugCallStack => Stack -> IO BVal Source #

peekOff :: DebugCallStack => Stack -> Off -> IO Val Source #

upeekOff :: DebugCallStack => Stack -> Off -> IO UVal Source #

bpeekOff :: DebugCallStack => Stack -> Off -> IO BVal Source #

bpoke :: DebugCallStack => Stack -> BVal -> IO () Source #

Store a boxed value. We don't bother nulling out the unboxed stack, it's extra work and there's nothing to garbage collect.

bpokeOff :: DebugCallStack => Stack -> Off -> BVal -> IO () Source #

pokeOff :: DebugCallStack => Stack -> Off -> Val -> IO () Source #

upokeT :: DebugCallStack => Stack -> UVal -> BVal -> IO () Source #

upokeOffT :: DebugCallStack => Stack -> Off -> UVal -> BVal -> IO () Source #

unsafePokeIasN :: DebugCallStack => Stack -> Int -> IO () Source #

Sometimes we get back an int from a foreign call which we want to use as a Nat. If we know it's positive and smaller than 2^63 then we can safely store the Int directly as a Nat without checks.

grab :: Stack -> SZ -> IO (Seg, Stack) Source #

Eats up arguments

Unboxed type tags