In Scala I can generate an exception that carries a value of some type parameter A
via case class MyException[A]( value: A ) extends Exception
Is there a way to define a similar type in F#?
exception MyException<'a> of 'a
is not possible as far as I can see. Do I need to generate a separate exception for each type it should carry? I guess I could define a type T = INT int | BOOL bool | PAIR T * T
and use it if I don't want to have multiple exceptions, but I'm wondering if there is a more elegant solution.