How can I find the type of a value in Haskell?
I want something like this:
data Vegetable =
Und Under
|Abv Above
is_vegetable ::a->Bool
is_vegetable a = if (a is of type Vegetable) then True else False
Update:
I want a datastructure to model the above tree.
I would also like to have some functions (is_drink, is_vegetable,is_wine,is_above) so that I can apply some filters on a list.

You cannot do this in Haskell. All function arguments have concrete types (like
IntandString) or they are type variables (like theain your example). Type variables can be restricted to belong to a certain type class.When you use an unrestricted type variable, then you cannot do anything interesting with the values of that type. By restricting the type variable to a type class, you get more power: if you have
Num a, then you know thatais a numeric type and so you can add, multiple, etc.From your comment, it sounds like you need a (bigger) data type to hold the different types of elements in your tree. The
Either a btype may come in handy here. It is eitherLeft aorRight band so you can have a function likeYour tree nodes will then be
Either Vegetable Dringelements.