Idris : Is it possible to rewrite all functions using “with” to use “case” instead of “with” ? If not, could you give a counter example?
问题 In Idris, is it possible to rewrite all functions using "with" to use "case" instead of "with" ? If not, could you give a counter example ? 回答1: Not possible. When you pattern match with with , the types in the context are updated with information extracted from the matched constructor. case doesn't cause such updating. As an example, the following works with with but not with case : import Data.So -- here (n == 10) in the goal type is rewritten to True or False -- after the match maybeTen :