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

haskell-works/hw-koans

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

开源软件名称:

haskell-works/hw-koans

开源软件地址:

https://github.com/haskell-works/hw-koans

开源编程语言:

Haskell 87.3%

开源软件介绍:

hw-koans CircleCI

Course for learn functional programming.

Prerequisites

  • cabal-3.0.0.0 or above
  • ghc-8.6.5 or above

Running

Run:

$ git clone [email protected]:haskell-works/hw-koans.git
$ cd hw-koans
$ cabal v2-test --enable-tests --test-show-details=direct
...
15 modules not enrolled
All enrolled 0 test modules succeeded
Test suite koan-test: PASS
...

The above output shows that there are 15 modules not enrolled. This course is structure into modules, which are found under the koan/Koan directory.

Each module defines the following a function:

enrolled :: Bool
enrolled = False

You will need to enable the module by changing enrolled to True then running the test command again:

$ cabal v2-test --enable-tests --test-show-details=direct
━━━ Check.Functor ━━━
  ✗ prop_fmap_void failed at test/Check/Functor.hs:43:3
    after 1 test and 1 shrink.

       ┏━━ test/Check/Functor.hs ━━━
    40 ┃ prop_fmap_void :: Property
    41 ┃ prop_fmap_void = property $ do
    42 ┃   mb <- forAll $ Gen.maybe (Gen.int Range.constantBounded)
       ┃   │ Nothing
    43 ┃   K.void mb === P.void mb
       ┃   ^^^^^^^^^^^^^^^^^^^^^^^
       ┃   │ ━━━ Exception (ErrorCall) ━━━
       ┃   │ TODO: implement void
       ┃   │ CallStack (from HasCallStack):
       ┃   │   error, called at koan/Koan/Functor.hs:34:8 in hw-koans-0.1.0.0-inplace:Koan.Functor

    This failure can be reproduced by running:
    > recheck (Size 0) (Seed 16511336219962586096 11754670307026383675) prop_fmap_void
...

From the above you can see the failure TODO: implement void in the module koan/Koan/Functor.hs file at line 34.

Go to that location to find the function void and implement it by replacing error "TODO: implement void" with a correct implementation:

void :: Functor f => f a -> f ()
void = error "TODO: implement void"

Run the test command to check that you've correctly implemented the function then repeat for the other failures until there are no more errors.

IDE support

The project will build & test in Visual Studio Code with ⌘⇧V.

List of modules

The following are modules in order of difficulty.

Introductory

  • Koan.Start
  • Koan.List
  • Koan.Eq
  • Koan.Ord
  • Koan.Simple

Beginner

  • Koan.Functor
  • Koan.Maybe
  • Koan.Applicative
  • Koan.Monad
  • Koan.State

Acknowledgements

This course was inspired by the Data 61 Functional Programming Course




鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
mfellner/falcor-koa: Falcor Middleware for Koa发布时间:2022-07-10
下一篇:
wejendorp/koa-timeout发布时间:2022-07-10
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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