{"id":13998219,"url":"https://github.com/dehun/learn-fp","last_synced_at":"2025-07-23T06:30:57.875Z","repository":{"id":79935091,"uuid":"113201873","full_name":"dehun/learn-fp","owner":"dehun","description":"learn-by-doing course/tutorial for functional programming on scala","archived":false,"fork":false,"pushed_at":"2020-02-07T08:35:13.000Z","size":1249,"stargazers_count":605,"open_issues_count":0,"forks_count":128,"subscribers_count":38,"default_branch":"master","last_synced_at":"2024-04-22T13:32:52.075Z","etag":null,"topics":["applicative","comonads","course","functional-idioms","functional-programming","functor","monad","monad-transformers","monads","monoid","scala","tutorial","typeclasses"],"latest_commit_sha":null,"homepage":"https://github.com/dehun/learn-fp","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dehun.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":"Contributing.md","funding":null,"license":"License","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-12-05T15:50:02.000Z","updated_at":"2024-04-19T17:42:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"81af16b1-dfbd-4531-8590-04c28394bca9","html_url":"https://github.com/dehun/learn-fp","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dehun%2Flearn-fp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dehun%2Flearn-fp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dehun%2Flearn-fp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dehun%2Flearn-fp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dehun","download_url":"https://codeload.github.com/dehun/learn-fp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227245137,"owners_count":17753239,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["applicative","comonads","course","functional-idioms","functional-programming","functor","monad","monad-transformers","monads","monoid","scala","tutorial","typeclasses"],"created_at":"2024-08-09T19:01:29.159Z","updated_at":"2024-11-30T00:31:17.700Z","avatar_url":"https://github.com/dehun.png","language":"Scala","readme":"# Learn Functional Programming course/tutorial on Scala  [![Build Status](https://travis-ci.org/dehun/learn-fp.svg?branch=master)](https://travis-ci.org/dehun/learn-fp) [![Build Status](https://travis-ci.org/dehun/learn-fp.svg?branch=answers)](https://travis-ci.org/dehun/learn-fp) #\n## Intro ##\nThis course/tutorial was created with purpose to better understand functional programming idioms using Scala language.\nIt covers type classes, monoids, functors, applicatives, monads, traversable/foldable, monad transformers, free monad.   \nMaterial is structured as set of stub/unimplemented functions/classes and tests for them.\nYour objective is to make all unit tests green. It is learn-by-doing course.\n\n## Example session ##\n![Example session](example.gif?raw=true \"Example session\")\n\n## Inspiration ##\nNICTA course was a great and interesting challenge for me to do in Haskell.\nI think Scala community will benefit from the similar course.\n\n## Target audience ##\nThe material in here is quite poor on theoretical/explanation part.\nI have tried to link material from other authors that I have found to be good into this course Readme to compensate for this.\nSome prior experience with functional idioms is recommended, but not necessary.\n\n## How to start ##\nJust git clone this repository and follow steps in progression section.\nYou can use any IDE and verify your results using `sbt test`. \nFor me intellij works best - you can easily run individual tests out of it.\nIn case if you got stuck - check answers branch.\n\n## Progression ##\nIt is important to keep the progression - a lot of things depend on each other.\nImplementing something = making all tests green for that thing.\n\n### Type classes ###\n\n- Observe general type class pattern in `learnfp/typeclass/TypeClass.scala`.\n- Implement `learnfp/typeclass/TotalOrder.scala`\n- Implement `learnfp/typeclass/Show.scala`\n- Implement `learnfp/typeclass/Eq.scala`\n- Extra material: \n  - https://blog.scalac.io/2017/04/19/typeclasses-in-scala.html\n\n### Monoids ###\n\n- Observe general monoid pattern in `learnfp/monoid/Monoid.scala`\n- Implement `learn-fp/src/main/scala/learnfp/monoid/ListMonoid.scala`\n- Implement `learn-fp/src/main/scala/learnfp/monoid/SimpleMonoid.scala`\n- Implement `learnfp/monoid/PairAdditiveMonoid.scala`\n- Extra material:\n  - Bartosz Milewski: Category Theory 3.1: Examples of categories, orders, monoids\n  \n\n### Functors ###\n\n- Observe general functor pattern in `learnfp/functor/Functor.scala`\n- Implement `learnfp/functor/Id.scala`\n- Implement `learnfp/functor/Maybe.scala`\n- Implement `learnfp/functor/List.scala`\n- Implement `learnfp/functor/Disjunction.scala`\n- Implement `learnfp/functor/Writer.scala`\n- Implement `learnfp/functor/State.scala`\n- Extra material:\n  - http://learnyouahaskell.com/functors-applicative-functors-and-monoids\n  - https://thedet.wordpress.com/2012/04/28/functors-monads-applicatives-can-be-so-simple/\n  - Bartosz Milewski: Category Theory 6.1: Functors \n\n### Monads ###\n\n- Observe general monad pattern in `learnfp/monad/Monad.scala`\n- Implement `learnfp/monad/Id.scala`\n- Implement `learnfp/monad/Maybe.scala`\n- Implement `learnfp/monad/List.scala`\n- Implement `learnfp/monad/Disjunction.scala`\n- Implement `learnfp/monad/Writer.scala`\n- Implement `learnfp/monad/State.scala`\n- Extra material\n  - Brian Beckman: Don't fear the Monad\n  - http://eed3si9n.com/learning-scalaz/Monad+transformers.html\n  \n### Foldable ###\n\n- Implement foldable in `learnfp/foldable/Foldable.scala`\n\n### Applicatives ###\n\n- Observe general applicative pattern in `learnfp/applicative/Applicative.scala`\n- Implement `learnfp/applicative/Id.scala`\n- Implement `learnfp/applicative/Maybe.scala`\n- Implement `learnfp/applicative/List.scala`\n- Implement `learnfp/applicative/Disjunction.scala`\n- Implement `learnfp/applicative/Writer.scala`\n- Implement `learnfp/applicative/State.scala`\n- Extra material \n  - https://en.wikibooks.org/wiki/Haskell/Applicative_functors\n  - http://eed3si9n.com/learning-scalaz/Applicative.html\n  \n### Traversable ###\n\n- Implement `learnfp/traversable/Traversable.scala`\n\n### Nested ###\n\n- Implement `learnfp/nested/Nested.scala`\n\n### IO ###\n\n- Implement `learnfp/io/IO.scala` \n\n### Monad Transformers ###\n\n- Observe general monad transformer typeclass in `learnfp/transformer/MonadTransformer.scala`\n- Implement `learnfp/transformer/IdT.scala`\n- Implement `learnfp/transformer/MaybeT.scala`\n- Implement `learnfp/transformer/WriterT.scala`\n- Implement `learnfp/transformer/StateT.scala`\n- Extra material: \n  - http://eed3si9n.com/learning-scalaz/Monad+transformers.html\n\n### Free monad ###\n\n- Implement `learnfp/free/Free.scala` and pass all unit tests in `learn-fp/src/test/scala/learnfp/free/FreeTest.scala`\n- Extra material:\n  - http://blog.krobinson.me/posts/monads-part-2-the-free-monad/\n  - https://underscore.io/blog/posts/2015/04/14/free-monads-are-simple.html\n  \n### Contravariant functor ###\n\n- Observe general contravariant functor pattern in `learnfp/contravariant/ContravariantFunctor.scala`\n- Implement `learnfp/contravariant/Show.scala`\n- Implement `learnfp/contravariant/Predicate.scala`\n\n### CoMonads ###\n\n- Observe general comonad pattern in `learnfp/comonad/CoMonad.scala`\n- Implement `learnfp/comonad/Id.scala`\n- Implement `learnfp/comonad/Env.scala`\n  \n### Bonus ###\n\n- Implement Reader functor, monad, applicative and write unit tests for that\n- Implement ReaderT and write unit tests for that\n- Implement applicative for monad transformers\n- Implement applicative for Free\n\n# What was left out #\n\n- Reader/ReaderT\n- Eff\n\n# Bugs/Issues #\nIn case if find a bug/issue - please report it to https://github.com/dehun/learn-fp/issues or e-mail me on yuriy.netesov@gmail.com  \nYou also are very welcome to create PR.\n  \n# Credits #\n\n- Yuriy Netesov - initial implementation\n- Extra material references are owned by other authors\n","funding_links":[],"categories":["Scala","\u003ca name=\"Scala\"\u003e\u003c/a\u003eScala"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdehun%2Flearn-fp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdehun%2Flearn-fp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdehun%2Flearn-fp/lists"}