convert to a idiomatic haskell library structure