[Haskell] implementing pointers-based data structure