Skip to content

Commit

Permalink
change dsl operator names
Browse files Browse the repository at this point in the history
  • Loading branch information
HLWeil committed Feb 28, 2023
1 parent bf9b8ea commit fd7e783
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/FsSpreadsheet/DSL/Operators.fs
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,21 @@ module Operators =
/// Required value operator
///
/// If expression does fail, returns a missing required value
let inline (!) (v : 'T) : SheetEntity<Value> =
let inline (~+.) (v : 'T) : SheetEntity<Value> =
let f = fun s -> NoneRequired([message s])
parseAny f v

/// Optional value operator
///
/// If expression does fail, returns a missing optional value
let inline (?) (v : 'T) : SheetEntity<Value> =
let inline (~-.) (v : 'T) : SheetEntity<Value> =
let f = fun s -> NoneOptional([message s])
parseAny f v

/// Required value operator
///
/// If expression does fail, returns a missing required value
let inline (>!) (f : 'T -> 'U) (v : 'T) : SheetEntity<Value> =
let inline (+.) (f : 'T -> 'U) (v : 'T) : SheetEntity<Value> =
try
f v
|> DataType.InferCellValue
Expand All @@ -81,20 +81,14 @@ module Operators =
/// Optional value operator
///
/// If expression does fail, returns a missing optional value
let inline (>?) (f : 'T -> 'U) (v : 'T) : SheetEntity<Value> =
let inline (-.) (f : 'T -> 'U) (v : 'T) : SheetEntity<Value> =
try
f v
|> DataType.InferCellValue
|> SheetEntity.some
with
| err -> NoneOptional([Exception err])

let inline (!<) (v : 'T) (f : 'T -> 'U) =
f >! v

let inline (?<) (v : 'T) (f : 'T -> 'U) =
f >? v

/// Optional operators for cell, row, column and sheet expressions
let optional = OptionalSource()

Expand Down

0 comments on commit fd7e783

Please sign in to comment.