gist

所属分类:GIS/地图编程
开发工具:Scala
文件大小:0KB
下载次数:0
上传日期:2018-08-03 13:50:50
上 传 者sh-1993
说明:  说明Scala中函数编程技术的一小段代码,
(Little snippets of code illustrating functional programming techniques in Scala,)

文件列表:
LICENSE (581, 2017-05-30)
build.sbt (1634, 2017-05-30)
project/ (0, 2017-05-30)
project/build.properties (20, 2017-05-30)
src/ (0, 2017-05-30)
src/main/ (0, 2017-05-30)
src/main/scala/ (0, 2017-05-30)
src/main/scala/MonadMacro.scala (2237, 2017-05-30)
src/test/ (0, 2017-05-30)
src/test/scala/ (0, 2017-05-30)
src/test/scala/ADTs.scala (4782, 2017-05-30)
src/test/scala/ChurchEncodings.scala (13984, 2017-05-30)
src/test/scala/Filter.scala (1143, 2017-05-30)
src/test/scala/GADTs.scala (7478, 2017-05-30)
src/test/scala/InitialAlgebras.scala (9545, 2017-05-30)
src/test/scala/LensStateIsYourFather.scala (7658, 2017-05-30)
src/test/scala/MonadAlgebras.scala (379, 2017-05-30)
src/test/scala/MonadMacro.scala (5525, 2017-05-30)
src/test/scala/coalgebras/ (0, 2017-05-30)
src/test/scala/coalgebras/package.scala (2729, 2017-05-30)
src/test/scala/coalgebras/scalaz/ (0, 2017-05-30)
src/test/scala/coalgebras/scalaz/automata.scala (1714, 2017-05-30)
src/test/scala/coalgebras/scalaz/automatasample.scala (1438, 2017-05-30)
src/test/scala/coalgebras/scalaz/cofreeactor.scala (3364, 2017-05-30)
src/test/scala/coalgebras/scalaz/cofreecochurch.scala (2110, 2017-05-30)
src/test/scala/coalgebras/scalaz/cofreecomonad.scala (1899, 2017-05-30)
src/test/scala/coalgebras/scalaz/cofreeweb.scala (3639, 2017-05-30)
src/test/scala/coalgebras/scalaz/finaladhoc.scala (1763, 2017-05-30)
src/test/scala/coalgebras/scalaz/programmingapplicatively.scala (1177, 2017-05-30)
src/test/scala/coalgebras/scalaz/programmingimperatively.scala (1851, 2017-05-30)
src/test/scala/coalgebras/scalaz/programmingwithexceptions.scala (1548, 2017-05-30)
src/test/scala/hello-monads/ (0, 2017-05-30)
src/test/scala/hello-monads/partI.scala (561, 2017-05-30)
src/test/scala/hello-monads/partII.scala (4090, 2017-05-30)
src/test/scala/hello-monads/partIII.scala (4001, 2017-05-30)
src/test/scala/objectalgebras-vs-free-vs-eff/ (0, 2017-05-30)
... ...

This repository contains little (and not so little) snippets of code that illustrate techniques from functional programming, mainly. Current gists ============= Some of these gists make reference or build upon results of previous ones. You'll also find some explanations throughout the code, although, surely, not enough to make them self-contained. This is the list of current gists: * [ADTs](https://github.com/hablapps/gist/blob/master/src/test/scala/ADTs.scala). How do we represent embedded DSLs using algebraic data types, and how do we implement both compositional and non-compositional interpreters. * [GADTs](https://github.com/hablapps/gist/blob/master/src/test/scala/GADTs.scala). How do we represent embedded DSLs using generalized algebraic data types, and how do we implement both compositional and non-compositional interpreters. * [Church encodings](https://github.com/hablapps/gist/blob/master/src/test/scala/ChurchEncodings.scala). What are Church encodings and how can we pattern match against them. * [Church encodings HK](https://github.com/hablapps/gist/blob/master/https://github.com/hablapps/gist/blob/hablacats/src/test/scala/ChurchEncodingsHK.scala). What are Higher-Kinded Church encodings and how can we pattern match against them. * [Church vs. ADTs](https://github.com/hablapps/gist/blob/master/src/test/scala/InitialAlgebras.scala). What is the relationship between these encodings? Algebras to the rescue! * [Church vs. GADTs](https://github.com/hablapps/gist/blob/master/https://github.com/hablapps/gist/blob/hablacats/src/test/scala/IsomorphismsHK.scala). Some isomorphisms between GADTs and Higher-Kinded Church encodings. * [Natural Numbers](https://github.com/hablapps/gist/blob/master/https://github.com/hablapps/gist/blob/hablacats/src/test/scala/NaturalEncodings.scala). Shows how we can represent Natural Numbers with different encodings: Church, Scott and Parigot. * [Bypassing Free](https://github.com/hablapps/gist/blob/master/src/test/scala/objectalgebras-vs-free-vs-eff). Check out how we can exploit object algebras to obtain the very same benefits of free monads, in many circumstances. * [Coalgebras](https://github.com/hablapps/gist/blob/master/src/test/scala/coalgebras). What are coalgebras? How are they related to monads and algebras in general? These gists attempt to shed some light to these questions. * [Lens, State Is Your Father](https://github.com/hablapps/gist/blob/master/src/test/scala/LensStateIsYourFather.scala). Encodings associated to a [blog post](https://github.com/hablapps/gist/blob/master/https://blog.hablapps.com/2016/11/10/lens-state-is-your-father/). There, we provide `IOCoalgebra` representations for several optics, along with some interesting insights. * [From "Hello, world!" to "Hello, monad!"](https://github.com/hablapps/gist/blob/master/src/test/scala/hello-monads/). Code associated to the [blog post](https://github.com/hablapps/gist/blob/master/https://blog.hablapps.com/2016/01/22/from-hello-world-to-hello-monad-part-i/) series about purification of effectful programs. * [Macro `monad`](https://github.com/hablapps/gist/blob/master/src/main/scala/MonadMacro.scala). A macro that allows you to write monadic code using neither `flatMap`s nor for-comprehensions, but conventional syntax, i.e. semicolons. Written with a pure didactic purpose: showing that monadic code is, in essence, simple imperative code. Executing gists =============== Each gist is implemented as a Scalatest file. In order to check its assertions, just enter `sbt` and launch the test. For instance, in order to launch the `ADTs` gist, enter `sbt` and type the following: ```scala > test-only org.hablapps.gist.ADTs ```

近期下载者

相关文件


收藏者