News for hackers. Stuff that matters.
Re:Adoption of Mypy for Python type checking: 45% already us... by throwaway81523 on Sunday March 21, 2021 @03:54PM (#26533370)
There actually seems to be no story about inductive types (e.g. trees) in Python and this appears due to well known theoretical difficulties combining subtyping (required for OO) and type inference (?). I.e. it is a hard problem. There are a few long term open mypy github issues about it, and some hacky workarounds, but no real answer. This is also why languages like Haskell (with good support for inductive types) tend to not have OO. I'm not exactly familiar with the issues, but there is some PLT literature about it, by Anton Setzer and others.
Re:Adoption of Mypy for Python type checking: 45% already us... by joshuamorton on Monday March 22, 2021 @12:13PM (#26542829)
Can you elaborate on this? Forward refs and recursive types are accepted on most places that isn't NewType, so you can make them, but not in a one liner.
Re:Adoption of Mypy for Python type checking: 45% already us... by throwaway81523 on Sunday March 28, 2021 @02:04PM (#26612596)
Sorry about the slow reply but I just noticed your question. Haskell supports recursive types just fine. The issue I'm mentioning is that it is hard to express those types in MyPy, which is a static typechecking add-on for Python, not Haskell.