Skip to content

Commit

Permalink
Merge pull request #166 from Kevin-Lee/task/165/add-website-using-doc…
Browse files Browse the repository at this point in the history
…usaurus

Task #165 - Changed: The doc site is now built using Docusaurus
  • Loading branch information
kevin-lee committed Jul 25, 2020
2 parents a8ee098 + 78b4610 commit d29fd61
Show file tree
Hide file tree
Showing 36 changed files with 13,530 additions and 92 deletions.
25 changes: 0 additions & 25 deletions docs/docs/docs/index.md

This file was deleted.

5 changes: 0 additions & 5 deletions docs/docs/docs/typeclass/applicative.md

This file was deleted.

5 changes: 0 additions & 5 deletions docs/docs/docs/typeclass/either-t.md

This file was deleted.

26 changes: 20 additions & 6 deletions docs/docs/index.md → docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
layout: home
title: "Just FP"
section: "home"
id: 'getting-started'
title: 'Getting Started'
---

# just-fp
## ![](../img/just-fp-logo-64x64.png) just-fp

[![Build Status](https://github.com/Kevin-Lee/just-fp/workflows/Build%20All/badge.svg)](https://github.com/Kevin-Lee/just-fp/actions?workflow=Build+All)
[![Release Status](https://github.com/Kevin-Lee/just-fp/workflows/Release/badge.svg)](https://github.com/Kevin-Lee/just-fp/actions?workflow=Release)
Expand All @@ -14,8 +13,23 @@ section: "home"
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.kevinlee/just-fp_2.13/badge.svg)](https://search.maven.org/artifact/io.kevinlee/just-fp_2.13)
[![Latest version](https://index.scala-lang.org/kevin-lee/just-fp/just-fp/latest.svg)](https://index.scala-lang.org/kevin-lee/just-fp/just-fp)

just-fp is a small Functional Programming library. This is not meant to be an alternative to Scalaz or Cats. The reason for having this library is that in your project you don't want to have Scalaz or Cats as its dependency and you only need much smaller set of functional programming features than what Scalaz or Cats offers. So the users of your library can choose Scalaz or Cats to be used with your library.

A small Functional Programming library. This is not meant to be an alternative to Scalaz or Cats. The reason for having this library is that in your project you don't want to have Scalaz or Cats as its dependency and you only need much smaller set of functional programming features than what Scalaz or Cats offers. So the users of your library can choose Scalaz or Cats to be used with your library.
## Getting Started
In `build.sbt`,

Please check out the [documentation](docs).
```scala
libraryDependencies += "io.kevinlee" %% "just-fp" % "1.3.5"
```
then import

```scala
import just.fp._
import just.fp.syntax._
```
or
```scala
import just.fp._, syntax._
```
In all the example code using `just-fp` below, I assume that you've already imported `just-fp` at the top.

34 changes: 0 additions & 34 deletions docs/microsite/data/menu.yml

This file was deleted.

4 changes: 2 additions & 2 deletions docs/docs/docs/syntax/either.md → docs/syntax/either.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
layout: docs
id: 'either'
title: "Either"
---

# Either
## Either

## Right-Biased `Either`
`Either` in Scala prior to 2.12 is not right-biased meaning that you have to call `Either.right` all the time if you want to use it with `for-comprehension`.
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/docs/syntax/option.md → docs/syntax/option.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
layout: docs
id: 'option'
title: "Option"
---

# Option
## Option
## Option Constructors
Similar to `Either`, creating `Option` can expose its data instead of type.

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/docs/syntax/index.md → docs/syntax/syntax.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: docs
id: 'syntax'
title: "Syntax"
---
# Syntax
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
layout: docs
id: 'type-safe-equal'
title: "Type-safe Equal"
---

# Type-safe Equal
## Type-safe Equal
`==` in Scala is not type safe so the following code can never be `true` as their types are different but it has no compile-time error.

```scala
Expand Down
5 changes: 5 additions & 0 deletions docs/typeclass/applicative.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
layout: 'applicative'
title: "Applicative"
---
## Applicative
5 changes: 5 additions & 0 deletions docs/typeclass/either-t.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
id: 'either-t'
title: "EitherT"
---
## EitherT
15 changes: 11 additions & 4 deletions docs/docs/docs/typeclass/functor.md → docs/typeclass/functor.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
layout: docs
id: 'functor'
title: "Functor"
---
# Functor
## Functor
A `functor` is a typeclass for the types that can be mapped over.

`Functor` complies with identity law and composition law.
Expand Down Expand Up @@ -31,13 +31,20 @@ import just.fp.syntax._
val f = (a: Int) => a + 100
val g = (b: Int) => b * 2

Functor[Option].map(1.some)(f compose g) === Functor[Option].map(Functor[Option].map(1.some)(g))(f)
Functor[Option].map(1.some)(f compose g)

Functor[Option].map(Functor[Option].map(1.some)(g))(f)

Functor[Option].map(none[Int])(f compose g) === Functor[Option].map(Functor[Option].map(none[Int])(g))(f)
Functor[Option].map(1.some)(f compose g) ===
Functor[Option].map(Functor[Option].map(1.some)(g))(f)


Functor[Option].map(none[Int])(f compose g)

Functor[Option].map(Functor[Option].map(none[Int])(g))(f)

Functor[Option].map(none[Int])(f compose g) ===
Functor[Option].map(Functor[Option].map(none[Int])(g))(f)
```


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: docs
id: 'monad'
title: "Monad"
---
# Monad
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: docs
id: 'monoid'
title: "Monoid"
---
# Monoid
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: docs
id: 'semi-group'
title: "Semi-Group"
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
layout: docs
id: 'typeclass'
title: "Typeclass"
---
# Typeclass
## Typeclass

* [Semi-Group](semi-group)
* [Monoid](monoid)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: docs
id: 'writer-t'
title: "WriterT"
---
# WriterT
20 changes: 20 additions & 0 deletions website/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
3 changes: 3 additions & 0 deletions website/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
88 changes: 88 additions & 0 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
module.exports = {
title: 'Just FP',
tagline: 'Just a small Functional Programming library',
url: 'https://just-fp.kevinly.dev',
baseUrl: '/',
favicon: 'img/favicon.png',
organizationName: 'Kevin-Lee',
projectName: 'just-fp',
themeConfig: {
sidebarCollapsible: false,
prism: {
theme: require('prism-react-renderer/themes/nightOwl'),
darkTheme: require('prism-react-renderer/themes/nightOwl'),
additionalLanguages: ['scala'],
},
navbar: {
title: 'Just FP',
logo: {
alt: 'Just FP Logo',
src: 'img/just-fp-logo-32x32.png',
},
links: [
{
to: 'docs/',
activeBasePath: 'docs',
label: 'Docs',
position: 'left',
},
{
href: 'https://github.com/Kevin-Lee/just-fp',
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{
label: 'Getting Started',
to: 'docs/',
},
],
},
{
title: 'More',
items: [
{
label: 'GitHub',
href: 'https://github.com/Kevin-Lee/just-fp',
},
{
label: 'Blog',
href: 'https://blog.kevinlee.io',
},
{
label: 'Homepage',
href: 'https://kevinlee.io',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} just-fp, <a href="https://github.com/Kevin-Lee" target="_blank">Kevin Lee</a>. Built with Docusaurus.`,
},
},
presets: [
[
'@docusaurus/preset-classic',
{
docs: {
path: '../generated-docs/target/mdoc/',
// It is recommended to set document id as docs home page (`docs/` path).
homePageId: 'getting-started',
sidebarPath: require.resolve('./sidebars.js'),
},
blog: {
showReadingTime: true,
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
},
],
],
};

0 comments on commit d29fd61

Please sign in to comment.