It would be really great to be able to deconstruct something based on its type. For example in Haskell
h :: Maybe Int -> Int
h x = case x of
Just n -> n * 100
Nothing -> 0
Not sure it is possible tho as we don't have an universal method to access the value inside a type.
Maybe some kind of interface the type must implement ?
It would be really great to be able to deconstruct something based on its type. For example in Haskell
Not sure it is possible tho as we don't have an universal method to access the value inside a type.
Maybe some kind of interface the type must implement ?