Haskell語言特性和標準庫的純Python實現:Hask
Hask是一個純Python,零依賴庫模仿了來自Haskell大部分語言核心語言工具,包括:
- Full Hindley-Milner type system (with typeclasses) that will typecheck any function decorated with a Hask type signature
- Easy creation of new algebraic data types and new typeclasses, with Haskell-like syntax
- Pattern matching withcaseexpressions
- Automagical function currying/partial application and function composition
- Efficient, immutable, lazily evaluatedListtype with Haskell-style list comprehensions
- All your favorite syntax and control flow tools, including operator sections, monadic error handling, guards, and more
- Python port of (some of) the standard libraries from Haskell'sbase, including:
- Algebraic datatypes from the HaskellPrelude, includingMaybeandEither
- Typeclasses from the Haskellbaselibraries, includingFunctor,Applicative,Monad,Enum,Num, and all the rest
- Standard library functions frombase, including all functions fromPrelude,Data.List,Data.Maybe, and more
Features not yet implemented, but coming soon:
- Python 3 compatibility
- Better support for polymorphic return values/type defaulting
- Better support for lazy evaluation (beyond just theListtype and pattern matching)
- More of the Haskell standard library (Control.*libraries, QuickCheck, and more)
- Monadic, lazy I/O
Note that all of this is still very much pre-alpha, and some things may be buggy!
Installation
1)git clone https://github.com/billpmurphy/hask
2)python setup.py install
To run the tests:python tests.py.
本文由用戶 dgbm 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!