runtime-core.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800
  1. 'use strict';
  2. /**
  3. * Pass Policy Definition
  4. *
  5. * - dirty: pass argument as a mutable reference
  6. * (the argument must be mutable)
  7. * - immutable: pass argument as an immutable reference
  8. * (the argument can be mutable or immutable, but not raw)
  9. * - natural: pass argument as is
  10. */
  11. const PassPolicy = Enum('dirty', 'immutable', 'natural')
  12. const PassAction = {
  13. dirty: x => assert(is(x, MutableObject)) && x,
  14. natural: x => x,
  15. immutable: x => ImRef(x)
  16. }
  17. const PassFlag = {
  18. dirty: '&',
  19. natural: '*',
  20. immutable: ''
  21. }
  22. const PassFlagValue = fold(
  23. Object.keys(PassFlag), {},
  24. (key, v) => (v[PassFlag[key]] = key, v)
  25. )
  26. /**
  27. * Effect Range Definition
  28. *
  29. * The effect range of a function determines the range of scope chain
  30. * that can be affected by the function, which indicates
  31. * the magnitude of side-effect.
  32. *
  33. * | value | Local Scope | Upper Scope | Other Scope |
  34. * |---------|-------------|-------------|-------------|
  35. * | global | full-access | full-access | full-access |
  36. * | upper | full-access | full-access | read-only |
  37. * | local | full-access | read-only | read-only |
  38. *
  39. */
  40. const EffectRange = Enum('global', 'upper', 'local')
  41. /**
  42. * Object Type Definition
  43. *
  44. * Object (Any) ┬ Compound ┬ Hash
  45. * │ ┴ List
  46. * ┼ Atomic ┬ Concept
  47. * ┴ Raw ┼ Iterator
  48. * ┼ Primitive ┬ String
  49. * │ ┼ Number
  50. * │ ┴ Bool
  51. * ┴ Functional ┬ Function
  52. * ┴ Overload
  53. *
  54. * Note: atomic object must be immutable.
  55. */
  56. /* Primitive Definition */
  57. const StringObject = $(x => typeof x == 'string')
  58. const NumberObject = $(x => typeof x == 'number')
  59. const BoolObject = $(x => typeof x == 'boolean')
  60. const PrimitiveObject = $u(StringObject, NumberObject, BoolObject)
  61. /* Atomic Definition */
  62. const FunctionalObject = $u(
  63. $(x => is(x, FunctionObject)),
  64. $(x => is(x, OverloadObject))
  65. )
  66. const AtomicObject = $u(
  67. PrimitiveObject,
  68. FunctionalObject,
  69. $(x => is(x, ConceptObject)),
  70. $(x => is(x, IteratorObject))
  71. )
  72. /* Hash Definition */
  73. const Config = {
  74. default: {
  75. immutable: false
  76. },
  77. from: object => pour({}, object.config),
  78. immutable_from: object => pour(Config.from(object), {
  79. immutable: true
  80. }),
  81. mutable_from: object => pour(Config.from(object), {
  82. immutable: false
  83. }),
  84. get_flags: Detail.Config.get_flags
  85. }
  86. function HashObject (hash = {}, config = Config.default) {
  87. assert(Hash.contains(hash))
  88. assert(Hash.contains(config))
  89. return {
  90. data: hash,
  91. config: config,
  92. maker: HashObject,
  93. __proto__: once(HashObject, Detail.Hash.Prototype)
  94. }
  95. }
  96. SetMakerConcept(HashObject)
  97. const ImHashObject = $n(HashObject, $(x => x.config.immutable))
  98. const MutHashObject = $n(HashObject, $(x => !x.config.immutable))
  99. /* List Definition */
  100. function ListObject (list = [], config = Config.default) {
  101. assert(is(list, List))
  102. assert(Hash.contains(config))
  103. return {
  104. data: list,
  105. config: config,
  106. maker: ListObject,
  107. __proto__: once(ListObject, Detail.List.Prototype)
  108. }
  109. }
  110. SetMakerConcept(ListObject)
  111. const ImListObject = $n(ListObject, $(x => x.config.immutable))
  112. const MutListObject = $n(ListObject, $(x => !x.config.immutable))
  113. /* Compound Definition */
  114. const CompoundObject = $u(HashObject, ListObject)
  115. const ImCompoundObject = $u(ImHashObject, ImListObject)
  116. const MutCompoundObject = $u(MutHashObject, MutListObject)
  117. /* Raw Definition */
  118. const CookedObject = $u(CompoundObject, AtomicObject)
  119. const RawObject = $_(CookedObject)
  120. const RawHashObject = $n(RawObject, StrictHash)
  121. const RawListObject = $n(RawObject, List)
  122. const RawCompoundObject = $u(RawListObject, RawHashObject)
  123. const RawFunctionObject = $n(RawObject, Fun)
  124. const NullObject = $1(null)
  125. const UndefinedObject = $1(undefined)
  126. const SymbolObject = $(x => typeof x == 'symbol')
  127. const CompatibleObject = $u(PrimitiveObject, RawObject)
  128. const RawableObject = $u(MutCompoundObject, FunctionalObject, CompatibleObject)
  129. function RawCompound (compound) {
  130. check(RawCompound, arguments, { compound: CompoundObject })
  131. let err = ErrorProducer(InvalidOperation, 'RawCompound')
  132. let msg = 'unable to raw immutable compound object'
  133. err.assert(is(compound, MutCompoundObject), msg)
  134. function raw_element (e) {
  135. return transform(e, [
  136. { when_it_is: CompoundObject, use: c => RawCompound(c) },
  137. { when_it_is: RawableObject, use: r => r },
  138. { when_it_is: Otherwise, use: o => err.throw('rawing non-rawable') }
  139. ])
  140. }
  141. return transform(compound, [
  142. { when_it_is: HashObject, use: h => mapval(h.data, raw_element) },
  143. { when_it_is: ListObject, use: l => map(l.data, raw_element) }
  144. ])
  145. }
  146. function CookCompound (raw_compound) {
  147. check(CookCompound, arguments, { raw_compound: RawCompoundObject })
  148. function cook_element (e) {
  149. return transform(e, [
  150. { when_it_is: RawCompoundObject, use: c => CookCompound(c) },
  151. { when_it_is: Otherwise, use: o => o }
  152. ])
  153. }
  154. return transform(raw_compound, [
  155. { when_it_is: StrictHash,
  156. use: h => HashObject(mapval(h, cook_element)) },
  157. { when_it_is: List,
  158. use: l => ListObject(map(l, cook_element)) }
  159. ])
  160. }
  161. /* Object (Any) Definition */
  162. const ObjectObject = $u(CompoundObject, AtomicObject, RawObject)
  163. pour(ObjectObject, Detail.Object)
  164. /* GetType Function Definition */
  165. function GetType(object) {
  166. let non_primitive = {
  167. Concept: $(x => ConceptObject.contains(x)),
  168. Iterator: $(x => IteratorObject.contains(x)),
  169. Function: $(x => FunctionObject.contains(x)),
  170. Overload: $(x => OverloadObject.contains(x)),
  171. List: ListObject,
  172. Hash: HashObject,
  173. Raw: RawObject
  174. }
  175. let checker = {
  176. 'string': () => 'String',
  177. 'number': () => 'Number',
  178. 'boolean': () => 'Bool',
  179. 'undefined': () => 'Raw',
  180. 'function': () => 'Raw',
  181. 'symbol': () => 'Raw',
  182. 'object': function (object) {
  183. let r = find(
  184. non_primitive,
  185. concept => concept.contains(object)
  186. )
  187. assert(r != NotFound)
  188. return r.key
  189. }
  190. }
  191. return checker[typeof object](object)
  192. }
  193. /**
  194. * Mutable and Immutable Definition
  195. */
  196. const MutableObject = $u(
  197. $n(CompoundObject, $(x => !x.config.immutable)),
  198. RawObject
  199. )
  200. const ImmutableObject = $_(MutableObject)
  201. /**
  202. * Immutable/Mutable Reference & Clone
  203. */
  204. function ImRef (object) {
  205. return transform(object, [
  206. {
  207. when_it_is: RawObject,
  208. use: x => ErrorProducer(InvalidOperation, 'ImRef').throw(
  209. 'unable to make immutable reference for raw object'
  210. )
  211. },
  212. {
  213. when_it_is: MutableObject,
  214. use: x => (x.maker)(
  215. x.data,
  216. Config.immutable_from(x)
  217. )
  218. },
  219. {
  220. when_it_is: Otherwise,
  221. use: x => x
  222. }
  223. ])
  224. }
  225. function Clone (object) {
  226. return transform(object, [
  227. {
  228. when_it_is: CompoundObject,
  229. use: x => (x.maker)(
  230. (x.mapper)(x.data, v => Clone(v)),
  231. Config.mutable_from(x)
  232. )
  233. },
  234. {
  235. when_it_is: $u(AtomicObject, RawObject),
  236. use: x => x
  237. }
  238. ])
  239. }
  240. /**
  241. * Concept Definition
  242. */
  243. function ConceptObject (name, f) {
  244. check(ConceptObject, arguments, {
  245. name: Str, f: $u(Fun, FunctionalObject)
  246. })
  247. let raw_checker = (is(f, Fun))? f: function (object) {
  248. return f.apply(object)
  249. }
  250. let wrapped_checker = function (object) {
  251. let result = raw_checker(object)
  252. assert(is(result, BoolObject))
  253. return result
  254. }
  255. return {
  256. name: name,
  257. checker: wrapped_checker,
  258. maker: ConceptObject,
  259. __proto__: once(ConceptObject, {
  260. toString: function () {
  261. return `Concept<'${this.name}'>`
  262. }
  263. })
  264. }
  265. }
  266. SetMakerConcept(ConceptObject)
  267. pour(ConceptObject, Detail.Concept)
  268. const ConceptListObject = $n(
  269. ListObject, $(x => is(x.data, ListOf(ConceptObject)))
  270. )
  271. /* Singleton Definition */
  272. function SingletonObject (name) {
  273. let singleton = {}
  274. pour(singleton, ConceptObject(
  275. `Singleton('${name}')`,
  276. object => object === singleton
  277. ))
  278. return singleton
  279. }
  280. /**
  281. * Iterator Definition
  282. */
  283. const ParameterCount = (n => $( x => (
  284. is(x, FunctionObject)
  285. && x.prototype.parameters.length == n
  286. )))
  287. const IteratorFunctionObject = ParameterCount(0)
  288. const MapperObject = ParameterCount(1)
  289. const FilterObject = ParameterCount(1)
  290. const ReducerObject = ParameterCount(2)
  291. function IteratorObject (f) {
  292. check(IteratorObject, arguments, {
  293. f: $u(Fun, IteratorFunctionObject)
  294. })
  295. let next = (is(f, Fun))? f: function () {
  296. return f.apply()
  297. }
  298. let wrapped_next = (function () {
  299. let done = false
  300. return function () {
  301. let value = next()
  302. assert(!(done && value != DoneObject))
  303. done = (value == DoneObject)? true: false
  304. return value
  305. }
  306. })()
  307. return {
  308. next: wrapped_next,
  309. maker: IteratorObject,
  310. __proto__: once(IteratorObject, {
  311. toString: function () {
  312. return `<Iterator>`
  313. }
  314. })
  315. }
  316. }
  317. SetMakerConcept(IteratorObject)
  318. const IterableObject = $u(ListObject, IteratorObject)
  319. const ListOfIterableObject = $n(
  320. ListObject, $(x => is(x.data, ListOf(IterableObject)))
  321. )
  322. const HashOfIterableObject = $n(
  323. HashObject, $(x => is(x.data, HashOf(IterableObject)))
  324. )
  325. /**
  326. * Scope Definition
  327. */
  328. const NullScope = { contains: SingletonContains, _name: 'NullScope' }
  329. function Scope (context, range, data = {}) {
  330. assert(is(context, Scope))
  331. assert(is(range, EffectRange))
  332. assert(Hash.contains(data))
  333. return {
  334. data: data,
  335. context: context,
  336. range: range, // effect range of function
  337. maker: Scope,
  338. __proto__: once(Scope, Detail.Scope.Prototype)
  339. }
  340. }
  341. SetEquivalent(Scope, $u(MadeBy(Scope), NullScope) )
  342. /**
  343. * Global Object Definition
  344. */
  345. const G = Scope(NullScope, 'global')
  346. const K = G.data
  347. K.scope = HashObject(G.data)
  348. const scope = G
  349. const id = (name => G.lookup(name))
  350. const VoidObject = SingletonObject('Void')
  351. const NaObject = SingletonObject('N/A')
  352. const DoneObject = SingletonObject('Done')
  353. pour(K, {
  354. Void: VoidObject,
  355. 'N/A': NaObject,
  356. Done: DoneObject,
  357. true: true,
  358. false: false,
  359. CR: CR,
  360. LF: LF,
  361. TAB: TAB
  362. })
  363. /**
  364. * Pair & Case Object Definition
  365. */
  366. const PairObject = $n(HashObject, $(x => is(x.data, Struct({
  367. key: Any, value: Any
  368. }))))
  369. const PairListObject = $n(
  370. ListObject, $(x => forall(x.data, e => is(e, PairObject)))
  371. )
  372. const CaseObject = $n(HashObject, $(x => is(x.data, Struct({
  373. key: $u(ConceptObject, FilterObject, BoolObject), value: Any
  374. }))))
  375. const CaseListObject = $n(
  376. ListObject, $(x => forall(x.data, e => is(e, CaseObject)))
  377. )
  378. /**
  379. * Function Definition
  380. */
  381. const Parameter = Struct({
  382. name: Str,
  383. constraint: ConceptObject,
  384. pass_policy: PassPolicy
  385. })
  386. const Prototype = Struct({
  387. effect_range: EffectRange,
  388. parameters: ListOf(Parameter),
  389. value_constraint: ConceptObject
  390. })
  391. pour(Prototype, Detail.Prototype)
  392. function FunctionObject (name, context, prototype, js_function) {
  393. check(FunctionObject, arguments, {
  394. name: Str,
  395. context: Scope,
  396. prototype: Prototype,
  397. js_function: Fun
  398. })
  399. fold(prototype.parameters, {}, function (parameter, appeared) {
  400. let err = ErrorProducer(RedundantParameter, 'Function::create()')
  401. let name = parameter.name
  402. err.if(
  403. appeared[name] !== undefined,
  404. `parameter ${name} defined more than once`
  405. )
  406. appeared[name] = true
  407. return appeared
  408. })
  409. return {
  410. name: name || '[Anonymous]',
  411. context: context,
  412. prototype: prototype,
  413. js_function: js_function,
  414. maker: FunctionObject,
  415. __proto__: once(FunctionObject, {
  416. apply: function (...args) {
  417. assert(is(args, ListOf(ObjectObject)))
  418. return this.call(fold(args, {}, (e, v, i) => (v[i] = e, v)) )
  419. },
  420. call: function (argument, caller) {
  421. assert(HashOf(ObjectObject).contains(argument))
  422. /* define error producers */
  423. let name = this.name
  424. let { err_a, err_r } = mapval({
  425. err_a: InvalidArgument,
  426. err_r: InvalidReturnValue,
  427. }, ErrorType => ErrorProducer(ErrorType, `${name}`))
  428. /* shortcuts */
  429. let Proto = Prototype
  430. let Range = EffectRange
  431. let { proto, range, f, context } = {
  432. proto: this.prototype,
  433. range: this.prototype.effect_range,
  434. f: this.js_function,
  435. context: this.context
  436. }
  437. /* check if argument valid */
  438. err_a.if_failed(Proto.check_argument(proto, argument))
  439. /* create new scope */
  440. let normalized = Proto.normalize_argument(proto, argument)
  441. let final = Proto.set_mutability(proto, normalized)
  442. let scope = Scope(context, range, {
  443. callee: this,
  444. argument: HashObject(final),
  445. argument_info: HashObject(
  446. mapval(normalized, v => HashObject({
  447. is_immutable: is(v, ImmutableObject)
  448. }))
  449. )
  450. })
  451. scope.data['scope'] = HashObject(scope.data)
  452. /**
  453. * it is not good to bind the name of function to the scope
  454. * because the function name in the scope could override
  455. * the previous overridden Overload, which is dumped in
  456. * the outer wrapper scope created by define() (runtime-tools)
  457. */
  458. // scope.data[name] = this
  459. pour(scope.data, final)
  460. /* invoke js function */
  461. let value = f(scope)
  462. /* debug output */
  463. let arg_str = Detail.Argument.represent(normalized)
  464. let val_str = ObjectObject.represent(value)
  465. console.log(`${name}${arg_str} = ${val_str}`)
  466. return value
  467. },
  468. toString: function () {
  469. let proto_repr = Prototype.represent(this.prototype)
  470. let split = proto_repr.split(' ')
  471. let effect = split.shift()
  472. let rest = split.join(' ')
  473. return `${effect} ${this.name} ${rest}`
  474. }
  475. })
  476. }
  477. }
  478. SetMakerConcept(FunctionObject)
  479. pour(FunctionObject, Detail.Function)
  480. /**
  481. * Function Overload Definition
  482. */
  483. function OverloadObject (name, instances) {
  484. check(OverloadObject, arguments, {
  485. name: Str,
  486. instances: $n(
  487. ListOf(FunctionObject),
  488. $(array => array.length > 0)
  489. ),
  490. equivalent_concept: Optional(ConceptObject)
  491. })
  492. return {
  493. name: name,
  494. instances: instances,
  495. maker: OverloadObject,
  496. __proto__: once(OverloadObject, {
  497. added: function (instance) {
  498. assert(is(instance, FunctionObject))
  499. let new_list = map(this.instances, x => x)
  500. new_list.push(instance)
  501. return OverloadObject(this.name, new_list)
  502. },
  503. concated: function (another) {
  504. assert(is(another, OverloadObject))
  505. let new_name = (
  506. (this.name == another.name)?
  507. this.name: `${this.name} ++ ${another.name}`
  508. )
  509. let new_list = list(cat(this.instances, another.instances))
  510. return OverloadObject(new_name, new_list)
  511. },
  512. apply: function (...args) {
  513. assert(is(args, ListOf(ObjectObject)))
  514. return this.call(fold(args, {}, (e, v, i) => (v[i] = e, v)) )
  515. },
  516. call: function (argument) {
  517. assert(HashOf(ObjectObject).contains(argument))
  518. let err = ErrorProducer(NoMatchingPattern, `${this.name}`)
  519. let check_arg = (
  520. proto => Prototype.check_argument(
  521. proto, argument
  522. )
  523. )
  524. let match = apply_on(this.instances, chain(
  525. x => rev(x),
  526. x => map_lazy(x, f => ({
  527. instance: f,
  528. is_ok: (check_arg(f.prototype) == OK)
  529. })),
  530. x => find(x, attempt => attempt.is_ok)
  531. ))
  532. err.if(match == NotFound, join_lines(
  533. `invalid call: match not found`,
  534. `available instances are:`, `${this}`
  535. ))
  536. return match.instance.call(argument)
  537. },
  538. find_method_for: function (object) {
  539. let name = `<${GetType(object)}>.${this.name}`
  540. let found = filter(
  541. this.instances,
  542. I => is(I, FunctionObject.MethodFor(object))
  543. )
  544. let methods = map(found, function (method) {
  545. // create wrappers
  546. let p = method.prototype.parameters
  547. let shifted = p.slice(1, p.length)
  548. let proto = pour(pour({}, method.prototype), {
  549. parameters: shifted
  550. })
  551. let first_parameter = p[0].name
  552. return FunctionObject(name, scope, proto, function (scope) {
  553. let extended_arg = {}
  554. pour(extended_arg, scope.data.argument.data)
  555. extended_arg[first_parameter] = object
  556. return method.call(extended_arg)
  557. })
  558. })
  559. if (methods.length > 0) {
  560. return OverloadObject('name', methods)
  561. } else {
  562. return NotFound
  563. }
  564. },
  565. toString: function () {
  566. return join(map(this.instances, I => I.toString()), '\n')
  567. }
  568. })
  569. }
  570. }
  571. SetMakerConcept(OverloadObject)
  572. /**
  573. * Port Native Concepts
  574. */
  575. function PortConcept(concept, name) {
  576. check(PortConcept, arguments, {
  577. concept: Concept, name: Str
  578. })
  579. return ConceptObject(name, x => is(x, concept))
  580. }
  581. pour(K, {
  582. /* any */
  583. Any: PortConcept(Any, 'Any'), // Any should be ObjectObject,
  584. // assert when calling FunctionObject
  585. /* atomic */
  586. Atomic: PortConcept(AtomicObject, 'Atomic'),
  587. /* concept */
  588. Concept: PortConcept(ConceptObject, 'Concept'),
  589. Iterator: PortConcept(IteratorObject, 'Iterator'),
  590. ConceptList: PortConcept(ConceptListObject, 'ConceptList'),
  591. /* iterable */
  592. Iterable: PortConcept(IterableObject, 'Iterable'),
  593. IterableList: PortConcept(ListOfIterableObject, 'IterableList'),
  594. IterableHash: PortConcept(HashOfIterableObject, 'IterableHash'),
  595. /* primitive */
  596. Bool: PortConcept(BoolObject, 'Bool'),
  597. Number: PortConcept(NumberObject, 'Number'),
  598. Int: PortConcept(Int, 'Int'),
  599. UnsignedInt: PortConcept(UnsignedInt, 'UnsignedInt'),
  600. String: PortConcept(StringObject, 'String'),
  601. Primitive: PortConcept(PrimitiveObject, 'Primitive'),
  602. /* functional */
  603. Function: PortConcept(FunctionObject, 'Function'),
  604. Overload: PortConcept(OverloadObject, 'Overload'),
  605. Functional: PortConcept(FunctionalObject, 'Functional'),
  606. IteratorFunction: PortConcept(IteratorFunctionObject, 'IteratorFunction'),
  607. Mapper: PortConcept(MapperObject, 'Mapper'),
  608. Filter: PortConcept(FilterObject, 'Filter'),
  609. Reducer: PortConcept(ReducerObject, 'Reducer'),
  610. /* compound */
  611. Compound: PortConcept(CompoundObject, 'Compound'),
  612. List: PortConcept(ListObject, 'List'),
  613. Hash: PortConcept(HashObject, 'Hash'),
  614. /* pair and case */
  615. Pair: PortConcept(PairObject, 'Pair'),
  616. PairList: PortConcept(PairListObject, 'PairList'),
  617. Case: PortConcept(CaseObject, 'Case'),
  618. CaseList: PortConcept(CaseListObject, 'CaseList'),
  619. /* mutability */
  620. ImHash: PortConcept(ImHashObject, 'ImHash'),
  621. MutHash: PortConcept(MutHashObject, 'MutHash'),
  622. ImList: PortConcept(ImListObject, 'ImList'),
  623. MutList: PortConcept(MutListObject, 'MutList'),
  624. ImCompound: PortConcept(ImCompoundObject, 'ImCompound'),
  625. MutCompound: PortConcept(MutCompoundObject, 'MutCompound'),
  626. Immutable: PortConcept(ImmutableObject, 'Immutable'),
  627. Mutable: PortConcept(MutableObject, 'Mutable'),
  628. /* raw object */
  629. Cooked: PortConcept(CookedObject, 'Cooked'),
  630. Raw: PortConcept(RawObject, 'Raw'),
  631. RawHash: PortConcept(RawHashObject, 'RawHash'),
  632. RawList: PortConcept(RawListObject, 'RawList'),
  633. RawCompound: PortConcept(RawCompoundObject, 'RawCompound'),
  634. RawFunction: PortConcept(RawFunctionObject, 'RawFunction'),
  635. Null: PortConcept(NullObject, 'Null'),
  636. Undefined: PortConcept(UndefinedObject, 'Undefined'),
  637. Symbol: PortConcept(SymbolObject, 'Symbol'),
  638. Compatible: PortConcept(CompatibleObject, 'Compatible'),
  639. Rawable: PortConcept(RawableObject, 'Rawable')
  640. })
  641. /* Concept Alias */
  642. pour(K, {
  643. Object: K.Any,
  644. Otherwise: K.Any,
  645. Index: K.UnsignedInt,
  646. Size: K.UnsignedInt
  647. })