Skip to content

Maybe

Name - Description Default Type
<input> Must match the input types of the first shard in the sequence. Any
<output> Will match the output types of the first shard of the sequence. Any
Shards The shards to activate. None Shard[ Shard ]
Else The shards to activate on failure. None Shard[ Shard ]
Silent If logging should be disabled while running the shards (this will also disable (Log) and (Msg) shards) and no warning message should be printed on failure. false Bool

Attempts to activate a shard or a sequence of shards. Upon failure, activate another shard or sequence of shards.

Examples

1
2
3
4
5
6
7
8
9
[1 2]
(Maybe
 ;:Shards
 (Take 3)
 ;:Else
 (Take 0)
 ;:Silent
 true)
(Log "result")
[info] [shards/General/Maybe/1.edn] result: 1

 

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
[1 2]
(Maybe
 ;:Shards
 (Take 3)
 ;:Else
 (->
  (Msg "Invalid, default to 42" LogLevel.Warning)
  42)
 ;:Silent
 true)
(Log "result")
[warning] [shards/General/Maybe/2.edn] Invalid, default to 42
[info] [shards/General/Maybe/2.edn] result: 42