finished work on haskell implementation