Safe Haskell | None |
---|---|
Language | Haskell2010 |
Basic data types used throughout the MOO server code
- type IntT = Int32
- type FltT = Double
- type StrT = MOOString
- type ObjT = ObjId
- type ErrT = Error
- type LstT = MOOList
- type ObjId = Int
- data Id
- type LineNo = Int
- data Type
- data Value
- data Error
- zero :: Value
- emptyString :: Value
- emptyList :: Value
- fromId :: Ident a => Id -> a
- toId :: Ident a => a -> Id
- builder2text :: Builder -> Text
- equal :: Value -> Value -> Bool
- comparable :: Value -> Value -> Bool
- truthOf :: Value -> Bool
- truthValue :: Bool -> Value
- typeOf :: Value -> Type
- typeCode :: Type -> IntT
- intValue :: Value -> Maybe IntT
- fltValue :: Value -> Maybe FltT
- strValue :: Value -> Maybe StrT
- objValue :: Value -> Maybe ObjT
- errValue :: Value -> Maybe ErrT
- lstValue :: Value -> Maybe LstT
- toText :: Value -> Text
- toBuilder :: Value -> Builder
- toBuilder' :: Value -> Builder
- toLiteral :: Value -> Text
- toMicroseconds :: Value -> Maybe Integer
- error2text :: Error -> Text
- fromList :: [Value] -> Value
- fromListBy :: (a -> Value) -> [a] -> Value
- stringList :: [StrT] -> Value
- objectList :: [ObjT] -> Value
- endOfTime :: UTCTime
- class Sizeable t where
- storageBytes :: t -> Int
Haskell Types Representing MOO Values
MOO identifier (string lite)
MOO Type and Value Reification
A Type
represents one or more MOO value types.
A Value
represents any MOO value.
A MOO error
E_NONE | No error |
E_TYPE | Type mismatch |
E_DIV | Division by zero |
E_PERM | Permission denied |
E_PROPNF | Property not found |
E_VERBNF | Verb not found |
E_VARNF | Variable not found |
E_INVIND | Invalid indirection |
E_RECMOVE | Recursive move |
E_MAXREC | Too many verb calls |
E_RANGE | Range error |
E_ARGS | Incorrect number of arguments |
E_NACC | Move refused by destination |
E_INVARG | Invalid argument |
E_QUOTA | Resource limit exceeded |
E_FLOAT | Floating-point arithmetic error |
An empty MOO string
Type and Value Functions
builder2text :: Builder -> Text Source
equal :: Value -> Value -> Bool Source
Test two MOO values for indistinguishable (case-sensitive) equality.
comparable :: Value -> Value -> Bool Source
Can the provided values be compared for relative ordering?
truthValue :: Bool -> Value Source
Return a default MOO value (integer) having the given boolean value.
typeCode :: Type -> IntT Source
Return an integer code corresponding to the given type. These codes are
visible to MOO code via the typeof()
built-in function and various
predefined variables.
toText :: Value -> Text Source
Return a Text
representation of the given MOO value, using the same
rules as the tostr()
built-in function.
toBuilder :: Value -> Builder Source
Return a Builder
representation of the given MOO value, using the same
rules as the tostr()
built-in function.
toBuilder' :: Value -> Builder Source
Return a Builder
representation of the given MOO value, using the same
rules as the toliteral()
built-in function.
toLiteral :: Value -> Text Source
Return a Text
representation of the given MOO value, using the same
rules as the toliteral()
built-in function.
toMicroseconds :: Value -> Maybe Integer Source
Interpret a MOO value as a number of microseconds.
error2text :: Error -> Text Source
Return a string description of the given error value.
List Convenience Functions
fromListBy :: (a -> Value) -> [a] -> Value Source
Turn a Haskell list into a MOO list, using a function to map Haskell values to MOO values.
stringList :: [StrT] -> Value Source
Turn a list of strings into a MOO list.
objectList :: [ObjT] -> Value Source
Turn a list of object numbers into a MOO list.
Miscellaneous
This is the last UTC time value representable as a signed 32-bit seconds-since-1970 value. Unfortunately it is used as a sentinel value in LambdaMOO to represent the starting time of indefinitely suspended tasks, so we really can't support time values beyond this point... yet.
Estimating Haskell Storage Sizes
The Sizeable
class is used to estimate the storage requirements of
various values, for use by several built-in functions which are supposed to
return the byte sizes of certain internal structures.
The sizes calculated by instances of this class are necessarily approximate, since it may be difficult or impossible to measure them precisely in the Haskell runtime environment.
storageBytes :: t -> Int Source
Return the estimated storage size of the given value, in bytes.