TryRemoveAllOptionals.yqls 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. (
  2. (let config (DataSource 'config))
  3. (let res_sink (DataSink 'result))
  4. ### Tuple
  5. # (Int8?, String?, (Int32, Int64)?) (success)
  6. (let value '((Just (Int8 '1)) (Just (String 'str)) (Just '((Int32 '2) (Int64 '3)))))
  7. (let tryRemoveAllOptionalsResult (TryRemoveAllOptionals value))
  8. (let world (Write! world res_sink (Key) tryRemoveAllOptionalsResult '('('type))))
  9. # (Int8?, String, (Int32, Int64)?) (success)
  10. (let value '((Just (Int8 '1)) (String 'str) (Just '((Int32 '2) (Int64 '3)))))
  11. (let tryRemoveAllOptionalsResult (TryRemoveAllOptionals value))
  12. (let world (Write! world res_sink (Key) tryRemoveAllOptionalsResult '('('type))))
  13. # (Int8?, Nothing(String?), (Int32, Int64)?) (fail)
  14. (let value '((Just (Int8 '1)) (Nothing (OptionalType (DataType 'String))) (Just '((Int32 '2) (Int64 '3)))))
  15. (let tryRemoveAllOptionalsResult (TryRemoveAllOptionals value))
  16. (let world (Write! world res_sink (Key) tryRemoveAllOptionalsResult '('('type))))
  17. # () (success)
  18. (let value '())
  19. (let tryRemoveAllOptionalsResult (TryRemoveAllOptionals value))
  20. (let world (Write! world res_sink (Key) tryRemoveAllOptionalsResult '('('type))))
  21. ### Struct
  22. # Struct<Int8?, String?, (Int32, Int64)?> (success)
  23. (let value (AsStruct '('a (Just (Int8 '1))) '('b (Just (String 'str))) '('c (Just '((Int32 '2) (Int64 '3))))))
  24. (let tryRemoveAllOptionalsResult (TryRemoveAllOptionals value))
  25. (let world (Write! world res_sink (Key) tryRemoveAllOptionalsResult '('('type))))
  26. # Struct<Int8?, String, (Int32, Int64)?> (success)
  27. (let value (AsStruct '('a (Just (Int8 '1))) '('b (String 'str)) '('c (Just '((Int32 '2) (Int64 '3))))))
  28. (let tryRemoveAllOptionalsResult (TryRemoveAllOptionals value))
  29. (let world (Write! world res_sink (Key) tryRemoveAllOptionalsResult '('('type))))
  30. # Struct<Int8?, Nothing(String?), (Int32, Int64)?> (fail)
  31. (let value (AsStruct '('a (Just (Int8 '1))) '('b (Nothing (OptionalType (DataType 'String)))) '('c (Just '((Int32 '2) (Int64 '3))))))
  32. (let tryRemoveAllOptionalsResult (TryRemoveAllOptionals value))
  33. (let world (Write! world res_sink (Key) tryRemoveAllOptionalsResult '('('type))))
  34. # Struct<> (success)
  35. (let value (Struct))
  36. (let tryRemoveAllOptionalsResult (TryRemoveAllOptionals value))
  37. (let world (Write! world res_sink (Key) tryRemoveAllOptionalsResult '('('type))))
  38. (let world (Commit! world res_sink))
  39. (return world)
  40. )