If I have an instance of an object, is there a way to check if I have a singleton object rather than an instance of a class? Is there any method can do this? May be some reflect
Here's what I found the best solution to this problem:
import scala.reflect.runtime.currentMirror def isSingleton(value: Any) = currentMirror.reflect(value).symbol.isModuleClass
Base on How to determine if `this` is an instance of a class or an object?