Fix IndexOutOfBounds bug and add haskell version
Add abstract ring operations