@@ -250,7 +250,7 @@ let private operators
250250 | Decimal -> Helper.LibCall( com, " fable_decimal" , " to_string" , _ t, [ arg ], ?loc = r) |> Some
251251 | Float16
252252 | Float32
253- | Float64 -> emitExpr r _ t [ arg ] " float_to_binary($0) " |> Some
253+ | Float64 -> Helper.LibCall ( com , " fable_convert " , " to_string " , _ t , [ arg ], ?loc = r ) |> Some
254254 | _ -> emitExpr r _ t [ arg ] " integer_to_binary($0)" |> Some
255255 | Type.Boolean -> emitExpr r _ t [ arg ] " atom_to_binary($0)" |> Some
256256 | _ -> Helper.LibCall( com, " fable_convert" , " to_string" , _ t, [ arg ], ?loc = r) |> Some
@@ -323,19 +323,8 @@ let private operators
323323 | " op_PipeLeft2" , [ f; x; y ] -> CurriedApply( f, [ x; y ], _ t, r) |> Some
324324 | " op_PipeRight3" , [ x; y; z; f ]
325325 | " op_PipeLeft3" , [ f; x; y; z ] -> CurriedApply( f, [ x; y; z ], _ t, r) |> Some
326- | " op_ComposeRight" , [ f1; f2 ] ->
327- // fun x -> f2(f1(x))
328- let ident = makeTypedIdent _ t " x"
329- let identExpr = IdentExpr ident
330- let innerCall = CurriedApply( f1, [ identExpr ], _ t, None)
331- let outerCall = CurriedApply( f2, [ innerCall ], _ t, None)
332- Lambda( ident, outerCall, None) |> Some
333- | " op_ComposeLeft" , [ f2; f1 ] ->
334- let ident = makeTypedIdent _ t " x"
335- let identExpr = IdentExpr ident
336- let innerCall = CurriedApply( f1, [ identExpr ], _ t, None)
337- let outerCall = CurriedApply( f2, [ innerCall ], _ t, None)
338- Lambda( ident, outerCall, None) |> Some
326+ | " op_ComposeRight" , [ f1; f2 ] -> compose com ctx r _ t f1 f2 |> Some
327+ | " op_ComposeLeft" , [ f2; f1 ] -> compose com ctx r _ t f1 f2 |> Some
339328 // Not (boolean negation)
340329 | " Not" , [ operand ] -> makeUnOp r _ t operand UnaryNot |> Some
341330 // Tuples
@@ -468,7 +457,7 @@ let private languagePrimitives
468457 let cmp = compare com r left right
469458 makeBinOp r Boolean cmp ( makeIntConst 0 ) BinaryGreaterOrEqual |> Some
470459 | ( " PhysicalEquality" | " PhysicalEqualityIntrinsic" ), [ left; right ] ->
471- makeBinOp r Boolean left right BinaryEqual |> Some
460+ emitExpr r Boolean [ left; right ] " $0 =:= $1 " |> Some
472461 | ( " GenericHash" | " GenericHashIntrinsic" ), [ arg ] ->
473462 Helper.LibCall( com, " fable_comparison" , " hash" , t, [ arg ], ?loc = r) |> Some
474463 | ( " PhysicalHash" | " PhysicalHashIntrinsic" ), [ arg ] ->
@@ -590,7 +579,9 @@ let private objects
590579 |> Some
591580 | Float16
592581 | Float32
593- | Float64 -> emitExpr r t [ thisObj ] " float_to_binary($0)" |> Some
582+ | Float64 ->
583+ Helper.LibCall( com, " fable_convert" , " to_string" , t, [ thisObj ], ?loc = r)
584+ |> Some
594585 | _ -> emitExpr r t [ thisObj ] " integer_to_binary($0)" |> Some
595586 | Type.Boolean -> emitExpr r t [ thisObj ] " atom_to_binary($0)" |> Some
596587 | Type.String -> Some thisObj
@@ -1209,7 +1200,7 @@ let private conversions
12091200 | Decimal -> Helper.LibCall( com, " fable_decimal" , " to_string" , t, [ arg ], ?loc = r) |> Some
12101201 | Float16
12111202 | Float32
1212- | Float64 -> emitExpr r t [ arg ] " float_to_binary($0) " |> Some
1203+ | Float64 -> Helper.LibCall ( com , " fable_convert " , " to_string " , t , [ arg ], ?loc = r ) |> Some
12131204 | _ -> emitExpr r t [ arg ] " integer_to_binary($0)" |> Some
12141205 | Type.Boolean -> emitExpr r t [ arg ] " atom_to_binary($0)" |> Some
12151206 | _ -> Helper.LibCall( com, " fable_convert" , " to_string" , t, [ arg ], ?loc = r) |> Some
@@ -1249,7 +1240,7 @@ let private numericTypes
12491240 | Decimal -> Helper.LibCall( com, " fable_decimal" , " to_string" , t, [ c ], ?loc = r) |> Some
12501241 | Float16
12511242 | Float32
1252- | Float64 -> emitExpr r t [ c ] " float_to_binary($0) " |> Some
1243+ | Float64 -> Helper.LibCall ( com , " fable_convert " , " to_string " , t , [ c ], ?loc = r ) |> Some
12531244 | _ -> emitExpr r t [ c ] " integer_to_binary($0)" |> Some
12541245 | _ -> None
12551246 | " ToString" , Some c, [ fmt ] ->
0 commit comments