Haskell implentation of heteregeneous value