nested_eval.sql 700 B

12345678910111213141516171819202122232425
  1. /* syntax version 1 */
  2. /* postgres can not */
  3. $make_struct = Callable(
  4. Callable<(String) -> Struct<lel : Int32>>,
  5. ($_string) -> { return AsStruct(5 as lel); }
  6. );
  7. $kekify_struct = ($struct) -> {
  8. return EvaluateCode(FuncCode("AsStruct",
  9. ListMap(
  10. StructTypeComponents(TypeHandle(TypeOf($struct))),
  11. ($_component) -> { return ListCode(AtomCode("kek"), ReprCode(42)); }
  12. )
  13. ));
  14. };
  15. $struct = AsStruct(
  16. Callable(
  17. Callable<(String)->Struct<kek : Int32>>,
  18. ($string) -> { return $kekify_struct($make_struct($string)); }
  19. ) as KekFromString,
  20. TypeHandle(Int32) as IntHandle
  21. );
  22. select FormatType(EvaluateType($struct.IntHandle));