Positive integer type

后端 未结 6 1730
野性不改
野性不改 2020-11-28 10:17

In many articles about Haskell they say it allows to make some checks during compile time instead of run time. So, I want to implement the simplest check possible - allow a

6条回答
  •  执念已碎
    2020-11-28 10:54

    Type-level natural numbers are planned for GHC 7.6.1: https://ghc.haskell.org/trac/ghc/ticket/4385

    Using this feature it's trivial to write a "natural number" type, and gives a performance you could never achieve (e.g. with a manually written Peano number type).

提交回复
热议问题