Idris2Doc : JS.Inheritance

JS.Inheritance

(source)

Definitions

interfaceJSType : Type->Type
  A `JSType` describes a type's inheritance chains and implemented
mixins. It is used to safely and conveniently cast a value to a
less specific type mentioned either in the list of
mixins or parent types by means of funciton `up` and operator `:>`.

Parameters: a
Methods:
parents : ListType
  The inheritance chain of parent types of this data type
(starting at the direct supertype). At runtime, such an inheritance
chain can be inspected by recursively calling the Javascript
function `Object.getPrototypeOf`.
mixins : ListType
  A Mixin is a concept from WebIDL: It is as programming interface
shared by several types. Unlike a WebIDL interface, a mixin does
not describe a type but just set of shared functions and
attributes. Mixins are not observable by means of inspecting
a value's prototype chain. It is therefore much harder
(and right now not supported in this library) to at runtime
check, whether a value implements a given mixin.

Implementation: 
JSTypeObject
parents : JSTypea=>ListType
  The inheritance chain of parent types of this data type
(starting at the direct supertype). At runtime, such an inheritance
chain can be inspected by recursively calling the Javascript
function `Object.getPrototypeOf`.

Totality: total
Visibility: public export
mixins : JSTypea=>ListType
  A Mixin is a concept from WebIDL: It is as programming interface
shared by several types. Unlike a WebIDL interface, a mixin does
not describe a type but just set of shared functions and
attributes. Mixins are not observable by means of inspecting
a value's prototype chain. It is therefore much harder
(and right now not supported in this library) to at runtime
check, whether a value implements a given mixin.

Totality: total
Visibility: public export
0Types : (0a : Type) ->JSTypea=>ListType
  Convenience alias for `parents`, which takes an explicit
erased type argument.

Totality: total
Visibility: public export
up : {auto0{conArg:2593} : JSTypea} ->a-> {auto0_ : Elemb (Typesa)} ->b
  Safe upcasting. This uses `believe_me` internally and is
therefore of course only safe, if the `JSType` implementation
is correct according to some specification and the backend
properly adhere to this specification.

Totality: total
Visibility: public export
(:>) : {auto0{conArg:2619} : JSTypea} ->a-> (0b : Type) -> {auto0_ : Elemb (Typesa)} ->b
  Operator version of `up`.

Totality: total
Visibility: public export
Fixity Declaration: infixl operator, level 1
interfaceSafeCast : Type->Type
  This is an interface which should be implemented by external
types, the type of which can be inspected at runtime.

This allows us to at runtime try and safely cast any value
to the type implementing this interface.

Typically, there are two mechanisms for inspecting a value's
type at runtime: Function `typeof`, which is mainly useful
for primitives, and function `unsafeCastOnPrototypeName`, which
inspects a value's prototype chain
([see also](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain)).

Note, that the intention of this interface is to use it
on *external* types and *primitives*, but not on types
defined in Idris2. If you need to marshal Idris2 values
from and to the FFI, use interfaces `ToJS` and `FromJS`.

Parameters: a
Methods:
safeCast : x->Maybea

Implementations:
SafeCastJSInt64
SafeCastJSBits64
SafeCastAny
SafeCastBoolean
SafeCasta=>SafeCast (Nullablea)
SafeCastUndefined
SafeCasta=>SafeCast (UndefOra)
SafeCastInteger
SafeCastDouble
SafeCastString
SafeCastChar
SafeCastBits8
SafeCastBits16
SafeCastBits32
SafeCastBits64
SafeCastInt8
SafeCastInt16
SafeCastInt32
SafeCastInt64
SafeCastInt
safeCast : SafeCasta=>x->Maybea
Totality: total
Visibility: public export
castTo : (0a : Type) ->SafeCasta=>x->Maybea
Totality: total
Visibility: public export
safeCastAny : AllSafeCastts=>x->Maybe (HSumts)
  Tries to create an n-ary sum by trying all possible
casts. The first successful cast will determine the
result.

Totality: total
Visibility: export
unsafeCastOnPrototypeName : String->a->Maybeb
  This is a utility function to implement instances of
`SafeCast`. Only use, if you know what you are doing.

Totality: total
Visibility: export
unsafeCastOnTypeof : String->a->Maybeb
  This is a utility function to implement instances of
`SafeCast`. Only use, if you know what you are doing.

Totality: total
Visibility: export
bounded : Numa=>Integer->Integer->x->Maybea
Totality: total
Visibility: export
tryCast : SafeCasta=> Lazy String->x->JSIOa
Totality: total
Visibility: export
tryCast_ : (0a : Type) ->SafeCasta=> Lazy String->x->JSIOa
Totality: total
Visibility: export
castingTo : SafeCasta=>String->JSIOx->JSIOa
Totality: total
Visibility: export