https://devhubby.com/thread/how-to-downcast-type-in-case-of-in-haskell