experimental port of my watchque-c/go to haskell