• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

lexi-lambda/hackett: WIP implementation of a Haskell-like Lisp in Racket

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

lexi-lambda/hackett

开源软件地址(OpenSource Url):

https://github.com/lexi-lambda/hackett

开源编程语言(OpenSource Language):

Racket 99.6%

开源软件介绍(OpenSource Introduction):

Hackett Build Status

Hackett is an attempt to implement a Haskell-like language with support for Racket’s macro system, built using the techniques described in the paper Type Systems as Macros. It is currently extremely work-in-progress.

Here are some of the features that Hackett supports right now:

  • Bidirectional type inference
  • Algebraic datatypes (ADTs)
  • Pattern matching
  • Exhaustiveness checking
  • Typeclasses (including multi-parameter typeclasses)
  • Higher-kinded types
  • Higher-rank polymorphism
  • Type-aware/type-directed macros
  • Laziness
  • Syntax for infix operators
  • Scoped type variables

Here are some of the features that still need to be implemented for a minimal release:

  • Orphan/overlapping instance detection/prevention
  • Strictness analysis
  • Kindchecking

And finally, here is a (non-exhaustive) collection of features I would like to eventually support:

  • Functional dependencies
  • Row types
  • GADTs
  • Type families

Due to the way Hackett is implemented, many things that are language features in Haskell can be derived concepts in Hackett. In fact, Hackett’s ADTs are not primitives, they are actually implemented as a library via the data and case macros in hackett/private/adt. Other things, like newtype deriving and generics, should be possible to implement as derived concepts as well.

Here’s some sample Hackett code that demonstrates some of Hackett’s features:

#lang hackett

(data (Maybe a)
  Nothing
  (Just a))

(def x : Integer
  (let ([y 3]
        [z 7])
    {y + z}))

(class (Show a)
  [show : {a -> String}])

(instance (forall [a] (Show a) => (Show (Maybe a)))
  [show (λ* [[(Just x)] {"(Just " ++ (show x) ++ ")"}]
            [[Nothing ] "Nothing"])])

For a much more in-depth look at Hackett, see the documentation.

Trying Hackett

To reiterate: Hackett is extremely experimental right now. Things are not guaranteed to work correctly (or work at all), and things are likely to change dramatically. If you really want to install Hackett to play around with it, though, you can.

You will need to have Racket installed to use Hackett. Using raco, you can install Hackett as a package:

$ raco pkg install hackett

Now you can use Hackett by writing #lang hackett at the top of a file.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
sdiehl/haskell-vim-proto: Basic starter config for Vim and Haskell发布时间:2022-06-22
下一篇:
raaz-crypto/raaz: Cryptographic library for Haskell发布时间:2022-06-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap