Create a custom type for disk indices
While (again) trying to test Python/Haskell encoding interoperability, I found another bug: the disk index is declared in Python as ht.TPositiveInt, but in Haskell just as Int, so it can take negative values too. Clearly we can do better, so let's add a wrapper type that protects creation of invalid indices via a smart constructor (http://www.haskell.org/haskellwiki/Smart_constructors , the runtime checking variant). This means that outside of OpCodes.hs, it's not possible to load invalid values, and this also applies to de-serialisation from JSON data. Signed-off-by:Iustin Pop <iustin@google.com> Reviewed-by:
Agata Murawska <agatamurawska@google.com>
Loading
Please register or sign in to comment