Since types are first-class in Idris, it seems like I should be able to write a typeOf
function that returns the type of its argument:
typeOf : a => a -> Type
typeOf x = a
However, when I attempt to call this function, I get what looks like an error:
*example> typeOf 42
Can't find implementation for Integer
How can I properly implement this typeOf
function? Or is there something more subtle about the idea of "getting the type of a value" that I'm missing, which would prevent the existence of such a function?