added "Val -> Maybe a" function to convert class