Haskell has a package to make testing this sort of thing easier https://hackage.haskell.org/package/inspection-testing