2

I have a serialization function that I feed data into, some times I miss an argument to the data generating function, and as a result I serialize the partially applied function. Json.Net does not throw up about this, but provides a nice empty object {}

I would like to constraint my serialization function to not accept partially applied arguments:

let mySerializer<'a when : 'a isnotafunction> (data:'a) : string = 
    JsonConvert.SerializeObject(data)

So far I have had no luck in finding a way of doing this.

Guy Coder
  • 24,501
  • 8
  • 71
  • 136
Vidar
  • 272
  • 1
  • 12

0 Answers0