I have defined data type for Binary numbers as follows
data Bin = Nil | O Bin | I Bin
deriving (Show, Eq)
i want to define a function reverse :: Bin -> Bin
so that when i give input like
reverse (I (O (I (I Nil))))
i should get the outut
I (I (O (I Nil)))
that means reversed as input, any body please give me hint how i can do this ?