« Previous | Next » 

Revision 4a1dc2bf

Parent f2f06e2e
Child 0384c457

Added by Iustin Pop over 11 years ago

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

Signed-off-by: Iustin Pop <>
Reviewed-by: Agata Murawska <>


  • added
  • modified
  • copied
  • renamed
  • deleted

View differences