Haskell stuff, misc codes