StrictCastOverNull.yqls 871 B

1234567891011121314151617181920212223242526272829
  1. (
  2. (let config (DataSource 'config))
  3. (let res_sink (DataSink 'result))
  4. # Null -> Uint16?
  5. (let cast (StrictCast (Null) (OptionalType (DataType 'Uint16))))
  6. (let world (Write! world res_sink (Key) cast '('('type))))
  7. # Just(Null) -> Null? [good]
  8. (let cast (StrictCast (Just (Null)) (NullType)))
  9. (let world (Write! world res_sink (Key) cast '('('type))))
  10. # Nothing(Null?) -> Null? [fail]
  11. (let cast (StrictCast (Nothing (OptionalType (NullType))) (NullType)))
  12. (let world (Write! world res_sink (Key) cast '('('type))))
  13. # Nothing(Uint16?) -> Null
  14. (let cast (StrictCast (Nothing (OptionalType (DataType 'Uint16))) (NullType)))
  15. (let world (Write! world res_sink (Key) cast '('('type))))
  16. # Null -> Null?
  17. (let cast (StrictCast (Null) (OptionalType (NullType))))
  18. (let world (Write! world res_sink (Key) cast '('('type))))
  19. (let world (Commit! world res_sink))
  20. (return world)
  21. )