I was looking for a Typeable implementation for Purescript and found this repo (https://github.com/joneshf/purescript-typeable) but -
- The repo looks abandoned.
- The typereps are unindexed.
- There is nothing stopping people from implementing typereps “wrong” for custom types.
Also, from this discussion it looks like there is no plan yet for adding compiler support for Typeable in Purescript
So to scratch my own itch, I hacked together something with FFI - https://github.com/ajnsit/purescript-typeable. It provides a
Typeable typeclass and allows writing mechanical instances for custom datatypes which are impossible to get wrong. It also provides an
eqTypeRep :: TypeRep a -> TypeRep b -> Boolean function.
This is still very crude but I just wanted to get feedback first. Is there a better way to do this?