I have a function to read a byte from an array:
let readByte array address = (* []<byte> -> int -> byte *)
(* ... *)
In an other function where I use this function very often, I'd like to do partial application:
let myOtherFunction array =
let readByteAsInt = readByte array
(* ... *)
let x = readByteAsInt address
Basically this works. In my example x is now of type byte but I would need it as an int. In this simple example I could cast the return value when assigning to x but as I said, I use readByteAsInt very often and I don't want to do the cast on every call.
I have tried
let readByteAsInt = int (readByte array)
and
let readByteAsInt = readByte array |> int
but both result in an error when calling readByteAsInt:
FS0003: This value is not a function and cannot be applied
How can I change the return type of the partial application?
Changing the signature of readByte to return an int is not an option as I do need byte elsewhere.