mirror of
https://github.com/logos-storage/questionable.git
synced 2026-01-12 10:43:08 +00:00
13 lines
368 B
Nim
13 lines
368 B
Nim
template liftUnary*(T: type, operator: untyped) =
|
|
|
|
template `operator`*(a: T): untyped =
|
|
a ->? `operator`(a.unsafeGet())
|
|
|
|
template liftBinary*(T: type, operator: untyped) =
|
|
|
|
template `operator`*(a: T, b: T): untyped =
|
|
(a, b) ->? `operator`(a.unsafeGet, b.unsafeGet)
|
|
|
|
template `operator`*(a: T, b: typed): untyped =
|
|
a ->? `operator`(a.unsafeGet(), b)
|