-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
638 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// pkl eval --format yaml -o release.yml release.pkl | ||
|
||
amends "package://pkg.pkl-lang.org/github.com/jamesward/pklgha/[email protected]#/GitHubAction.pkl" | ||
|
||
on { | ||
push { | ||
|
||
} | ||
workflow_dispatch { | ||
|
||
} | ||
} | ||
|
||
permissions { | ||
contents = "read" | ||
pages = "write" | ||
`id-token` = "write" | ||
} | ||
|
||
concurrency { | ||
group = "pages" | ||
`cancel-in-progress` = false | ||
} | ||
|
||
jobs { | ||
["deploy"] = new { | ||
environment { | ||
name = "github-pages" | ||
url = "${{ steps.deployment.outputs.page_url }}" | ||
} | ||
`runs-on` = "ubuntu-latest" | ||
|
||
steps { | ||
new { | ||
uses = "actions/checkout@v4" | ||
} | ||
|
||
new { | ||
name = "generate website" | ||
run = """ | ||
pip install -r requirements.txt | ||
mkdocs build | ||
""" | ||
} | ||
|
||
new { | ||
uses = "actions/configure-pages@v5" | ||
} | ||
|
||
new { | ||
uses = "actions/upload-pages-artifact@v3" | ||
with { | ||
["path"] = "site" | ||
} | ||
} | ||
|
||
new { | ||
id = "deployment" | ||
uses = "actions/deploy-pages@v4" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Generated file. DO NOT EDIT. | ||
'on': | ||
push: {} | ||
workflow_dispatch: {} | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
concurrency: | ||
group: pages | ||
cancel-in-progress: false | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: generate website | ||
run: |- | ||
pip install -r requirements.txt | ||
mkdocs build | ||
- uses: actions/configure-pages@v5 | ||
- uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: site | ||
- id: deployment | ||
uses: actions/deploy-pages@v4 | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/.idea/ | ||
/site/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
EffectOrientedProgramming.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,2 @@ | ||
# Effect Oriented Programming | ||
# Effect Oriented Programming - Website | ||
|
||
The book is coming soon! | ||
|
||
[Get notified when it is available](https://leanpub.com/effect-oriented-programming) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Authors | ||
|
||
## Bill Frasure | ||
|
||
## James Ward | ||
|
||
## Bruce Eckel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
# License | ||
|
||
All rights reserved. Printed in the United States of America. This publication | ||
is protected by copyright, and permission must be obtained from the publisher | ||
prior to any prohibited reproduction, storage in a retrieval system, or | ||
transmission in any form or by any means, electronic, mechanical, photocopying, | ||
recording, or likewise. For information regarding permissions, see | ||
[EffectOrientedProgramming.com](https://www.effectorientedprogramming.com/). | ||
|
||
Created in Crested Butte, Colorado, USA. | ||
|
||
Text printed in the United States | ||
|
||
> **Ebook: Version 1.0, Month Year** | ||
> | ||
> **First printing Month Year** | ||
Cover design by Daniel Will-Harris, | ||
[www.Will-Harris.com](http://www.Will-Harris.com) | ||
|
||
Many of the designations used by manufacturers and sellers to distinguish their | ||
products are claimed as trademarks. Where those designations appear in this | ||
book, and the publisher was aware of a trademark claim, the designations are | ||
printed with initial capital letters or in all capitals. | ||
|
||
The Scala language is copyright: | ||
|
||
© 2002-2024 EPFL | ||
|
||
© 2011-2024 Lightbend, Inc. | ||
|
||
Java is a trademark or registered trademark of Oracle, Inc. in the United States and | ||
other countries. Windows is a registered trademark of Microsoft Corporation in | ||
the United States and other countries. All other product names and company | ||
names mentioned herein are the property of their respective owners. | ||
|
||
The authors and publisher have taken care in the preparation of this book, but | ||
make no expressed or implied warranty of any kind and assume no responsibility | ||
for errors or omissions. No liability is assumed for incidental or | ||
consequential damages in connection with or arising out of the use of the | ||
information or programs contained herein. | ||
|
||
Visit us at [EffectOrientedProgramming.com](https://www.effectorientedprogramming.com/). | ||
|
||
## Source Code | ||
|
||
All the source code for this book is available as copyrighted freeware, | ||
distributed via [GitHub](https://github.com/EffectOrientedProgramming/examples). | ||
To ensure you have the most current version, this is the official code | ||
distribution site. You may use this code in classroom and other educational | ||
situations as long as you cite this book as the source. | ||
|
||
The primary goal of this copyright is to ensure that the source of the code is | ||
properly cited, and to prevent you from republishing the code without | ||
permission. (As long as this book is cited, using examples from the book in | ||
most media is generally not a problem.) | ||
|
||
In each source-code file you find a reference to the following copyright notice: | ||
|
||
```text | ||
// Copyright.txt | ||
This computer source code is Copyright ©2024 Billding Software LLC. | ||
All Rights Reserved. | ||
Permission to use, copy, modify, and distribute this | ||
computer source code (Source Code) and its documentation | ||
without fee and without a written agreement for the | ||
purposes set forth below is hereby granted, provided that | ||
the above copyright notice, this paragraph and the | ||
following five numbered paragraphs appear in all copies. | ||
1. Permission is granted to compile the Source Code and to | ||
include the compiled code, in executable format only, in | ||
personal and commercial software programs. | ||
2. Permission is granted to use the Source Code without | ||
modification in classroom situations, including in | ||
presentation materials, provided that the book "Effect Oriented | ||
Programming" is cited as the origin. | ||
3. Permission to incorporate the Source Code into printed | ||
media may be obtained by contacting: | ||
Billding Software LLC, 111 Alpine Court, Crested Butte, CO 81224 | ||
[email protected] | ||
4. The Source Code and documentation are copyrighted by | ||
Billding Software LLC. The Source code is provided without express | ||
or implied warranty of any kind, including any implied | ||
warranty of merchantability, fitness for a particular | ||
purpose or non-infringement. Billding Software LLC does not | ||
warrant that the operation of any program that includes the | ||
Source Code will be uninterrupted or error-free. Billding Software | ||
makes no representation about the suitability of the | ||
Source Code or of any software that includes the Source | ||
Code for any purpose. The entire risk as to the quality | ||
and performance of any program that includes the Source | ||
Code is with the user of the Source Code. The user | ||
understands that the Source Code was developed for research | ||
and instructional purposes and is advised not to rely | ||
exclusively for any reason on the Source Code or any | ||
program that includes the Source Code. Should the Source | ||
Code or any resulting software prove defective, the user | ||
assumes the cost of all necessary servicing, repair, or | ||
correction. | ||
5. IN NO EVENT SHALL BILLDING SOFTWARE LLC, OR ITS PUBLISHER BE | ||
LIABLE TO ANY PARTY UNDER ANY LEGAL THEORY FOR DIRECT, | ||
INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, | ||
INCLUDING LOST PROFITS, BUSINESS INTERRUPTION, LOSS OF | ||
BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS, OR FOR | ||
PERSONAL INJURIES, ARISING OUT OF THE USE OF THIS SOURCE | ||
CODE AND ITS DOCUMENTATION, OR ARISING OUT OF THE INABILITY | ||
TO USE ANY RESULTING PROGRAM, EVEN IF BILLDING SOFTWARE LLC, OR | ||
ITS PUBLISHER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH | ||
DAMAGE. BILLDING SOFTWARE LLC SPECIFICALLY DISCLAIMS ANY | ||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
PURPOSE. THE SOURCE CODE AND DOCUMENTATION PROVIDED | ||
HEREUNDER IS ON AN "AS IS" BASIS, WITHOUT ANY ACCOMPANYING | ||
SERVICES FROM BILLDING SOFTWARE LLC, AND BILLDING SOFTWARE LLC HAS NO | ||
OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, | ||
ENHANCEMENTS, OR MODIFICATIONS. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<!-- ### Windows | ||
|
||
Run the following commands (**Note:** Use cmd.exe, not Powershell): | ||
|
||
``` | ||
> bitsadmin /transfer cs-cli https://git.io/coursier-cli-windows-exe "%cd%\cs.exe" | ||
> .\cs --help | ||
``` | ||
|
||
### Macintosh | ||
|
||
Run the following commands: | ||
|
||
``` | ||
> curl -fLo cs https://git.io/coursier-cli-"$(uname | tr LD ld)" | ||
> chmod +x cs | ||
> ./cs install cs | ||
``` | ||
|
||
### Linux | ||
|
||
Use `curl` to install **Coursier**: | ||
|
||
``` | ||
> curl -fLo cs https://git.io/coursier-cli-"$(uname | tr LD ld)" | ||
> cs | ||
``` | ||
Running the `cs` command verifies that Coursier was installed. | ||
Now open a fresh terminal before proceeding. | ||
|
||
If the terminal displays a message saying 'cs is not found', | ||
check the previous command. Otherwise, enter these | ||
commands to give execute permission to Coursier and install the | ||
package: | ||
|
||
``` | ||
> chmod +x cs | ||
> ./cs install cs | ||
> eval "$(cs install --env)" | ||
``` | ||
|
||
If the terminal displays a message like: | ||
|
||
``` | ||
Warning: /home/ExamplePath/Example/coursier/bin is not in your PATH | ||
``` | ||
|
||
Use the following command, replacing the `<Insert Path>` with the path from the | ||
above warning message: | ||
|
||
``` | ||
> export PATH="$PATH:/<Insert Path>/coursier/bin" | ||
``` | ||
|
||
For example, if the warning message is: | ||
|
||
``` | ||
Warning: /home/bob/.local/share/coursier/bin is not in your PATH | ||
``` | ||
|
||
Run this: | ||
|
||
``` | ||
> export PATH="$PATH:/home/bob/.local/share/coursier/bin" | ||
``` | ||
|
||
You'll want to put a line like this in your `~/.bashrc`, as well. | ||
|
||
Then enter these commands to give execute permission to Coursier and install the | ||
package: | ||
|
||
``` | ||
> chmod +x cs | ||
> ./cs install cs | ||
> eval "$(cs install --env)" | ||
``` --> | ||
|
||
|
||
|
||
|
||
<!-- However, we want the latest Long Term Support (LTS) version. At this writing it's version 21, so enter: | ||
|
||
```text | ||
> cs java --jvm 21 -version | ||
``` | ||
|
||
This installs the latest Java version 21, but does not use it as the default version, as you'll see if you run `cs java -version`. | ||
To switch to the newly-installed version, enter: | ||
--> | ||
|
||
|
||
<!-- 2. `javac -version` | ||
Output will be something like: | ||
```text | ||
javac 11.0.23 | ||
``` --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Running the Book Code | ||
|
||
## Install the Example Code | ||
|
||
Download the [zipped code repository](https://github.com/EffectOrientedProgramming/examples). | ||
To find the zipped version, press the green "Code" button. | ||
Unpack the archive. | ||
|
||
## Install IntelliJ IDEA | ||
|
||
We use IntelliJ IDEA to develop the examples in this book. | ||
You may use another environment such as VSCode but if you do you'll need to figure it out yourself. | ||
|
||
1. Follow the instructions [here](https://www.jetbrains.com/help/idea/installation-guide.html) | ||
to install IntelliJ IDEA. | ||
|
||
1. Start IntelliJ IDEA, and choose 'Open' to open an existing project. | ||
Navigate to where you unzipped the repository. | ||
|
||
1. If the Scala plugin isn't installed, IDEA will prompt you. | ||
Accept the prompt to install the plugin. | ||
|
||
1. When you open any of the chapter files in `src/main/scala`, as you scroll down you will | ||
see green arrows on the left of each runnable example. | ||
When you press an arrow, that example will run in a console and show you the output. | ||
|
||
1. You might need to restart JetBrains IDEA after configuring. | ||
Also check for running tasks in the IDE; you might need to wait the first time you open the project before the green arrows appear. | ||
|
||
<!-- | ||
3. Go to the menu and select: | ||
`View | Tool Windows | sbt`. Right-click the directory name, and reload the sbt project. | ||
This should ensure your machine has all necessary plugins and extensions installed. | ||
- If you get a message: | ||
```text | ||
Scalafmt configuration detected in this project | ||
Use scalafmt formatter | ||
Continue using IntelliJ formatter | ||
``` | ||
Select `Use scalafmt formatter` --> | ||
|
||
## Configuring the Scala SDK | ||
|
||
When you open a Scala file in IntelliJ, you might get a message in the title bar of that file: | ||
``` | ||
No Scala SDK in module | ||
``` | ||
On the right side of that message bar, you'll see: | ||
``` | ||
Setup Scala SDK | ||
``` | ||
Click on this. In the resulting dialog box, select "Create" and choose the latest Coursier version of Scala, which will be | ||
version 3.x. The Dialog box will now look something like this: | ||
|
||
![image](https://user-images.githubusercontent.com/1001900/126879631-6490636e-7db5-4e4f-90c6-82292ff2569f.png) | ||
|
||
Select "OK". Now go to `File | Project Structure | Global Libraries` and Choose Scala 3, like this: | ||
|
||
![image](https://user-images.githubusercontent.com/1001900/126879808-1285e65e-e674-4a9b-9246-c86f86956e90.png) |
Oops, something went wrong.