Skip to content

Commit 6412666

Browse files
authored
Merge pull request #79 from joshuanianji/example
Example Project
2 parents 2ac5e5b + 81959b8 commit 6412666

File tree

6 files changed

+106
-22
lines changed

6 files changed

+106
-22
lines changed

README.md

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ Idris Versions: `v0.5.1`, `v0.6.0`, `v0.7.0`, `latest` (Up to date with [Idris2/
1212
- [Table of Contents](#table-of-contents)
1313
- [Motivation](#motivation)
1414
- [Images](#images)
15-
- [Devcontainer Demo: Wordle in Idris](#devcontainer-demo-wordle-in-idris)
16-
- [Prerequisites](#prerequisites)
17-
- [Opening in a Devcontainer](#opening-in-a-devcontainer)
15+
- [Example Project](#example-project)
1816
- [Usage](#usage)
1917
- [Devcontainer](#devcontainer)
2018
- [Command Line](#command-line)
@@ -35,30 +33,16 @@ Installing Idris2 is [quite time consuming](https://idris2.readthedocs.io/en/lat
3533
* [idris-2-docker/ubuntu](https://github.com/joshuanianji/idris-2-docker/pkgs/container/idris-2-docker%2Fubuntu) - Ubuntu 20.04
3634
* [idris-2-docker/debian](https://github.com/joshuanianji/idris-2-docker/pkgs/container/idris-2-docker%2Fdebian) - Debian bullseye
3735

38-
## Devcontainer Demo: Wordle in Idris
36+
## Example Project
3937

40-
Devcontainers use a Docker container as a full-featured development environment, making it super simple to get started with Idris2. For more information, check out [Microsoft's documentation](https://code.visualstudio.com/docs/remote/containers).
41-
42-
If you want to try out a quick ready-to-use project, take a look at [calebji123/WordleInIdris](https://github.com/calebji123/WordleInIdris). The devcontainer files there are set up and it's super fun to play around with!
43-
44-
### Prerequisites
45-
46-
* A working instance of [Docker](https://docs.docker.com/get-docker/)
47-
* [VSCode](https://code.visualstudio.com/download)
48-
* [Remote Development Extension Pack](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack) for VSCode
49-
50-
### Opening in a Devcontainer
38+
An example Hello World project taken from the [Getting Started Guide](https://idris2.readthedocs.io/en/latest/tutorial/starting.html) can be found in [example](./example). It uses Idris 0.7.0. To start, clone this repo and open the example folder (not the root!) in VSCode.
5139

5240
```bash
53-
git clone https://github.com/calebji123/WordleInIdris.git
41+
git clone [email protected]:joshuanianji/idris-2-docker.git
42+
cd idris-2-docker/example
43+
code .
5444
```
5545

56-
Once you clone the repo, open the folder in VSCode. There will be a prompt on the bottom right.
57-
58-
![Reopen in Container](./docs/reopen-in-container.png)
59-
60-
Click "Reopen in Container" and it will download the image and open the project in a devcontainer. You'll be able to [run the project right away](https://github.com/calebji123/WordleInIdris#how-to-run-it)!
61-
6246
## Usage
6347

6448
### Devcontainer
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
3+
{
4+
"name": "Idris2 Devcontainer",
5+
"image": "ghcr.io/joshuanianji/idris-2-docker/devcontainer:v0.7.0",
6+
"features": {
7+
"ghcr.io/devcontainers/features/common-utils:2": {}
8+
},
9+
"customizations": {
10+
"vscode": {
11+
"extensions": [
12+
"bamboo.idris2-lsp"
13+
]
14+
}
15+
}
16+
// Features to add to the dev container. More info: https://containers.dev/features.
17+
// "features": {},
18+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
19+
// "forwardPorts": [],
20+
// Configure tool-specific properties.
21+
// "customizations": {},
22+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
23+
// "remoteUser": "root"
24+
}

example/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build

example/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Hello World
2+
3+
This is a simple hello-world example using Idris 0.7, taken from the [Getting Started Guide](https://idris2.readthedocs.io/en/latest/tutorial/starting.html).
4+
5+
To start, open the example folder in vscode and run `Reopen in Container` from the command palette.
6+
7+
Once the container is running, you can play with Idris2!
8+
9+
```bash
10+
$ idris2 hello.idr
11+
____ __ _ ___
12+
/ _/___/ /____(_)____ |__ \
13+
/ // __ / ___/ / ___/ __/ / Version 0.7.0
14+
_/ // /_/ / / / (__ ) / __/ https://www.idris-lang.org
15+
/___/\__,_/_/ /_/____/ /____/ Type :? for help
16+
17+
Welcome to Idris 2. Enjoy yourself!
18+
Main> :t main
19+
Main.main : IO ()
20+
Main> :c hello main
21+
File build/exec/hello written
22+
Main> :q
23+
Bye for now!
24+
```

example/hello.idr

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Main
2+
3+
main : IO ()
4+
main = putStrLn "Hello world"

example/hello.ipkg

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package hello
2+
-- version =
3+
-- authors =
4+
-- maintainers =
5+
-- license =
6+
-- brief =
7+
-- readme =
8+
-- homepage =
9+
-- sourceloc =
10+
-- bugtracker =
11+
12+
-- the Idris2 version required (e.g. langversion >= 0.5.1)
13+
-- langversion
14+
15+
-- packages to add to search path
16+
-- depends =
17+
18+
-- modules to install
19+
modules = README
20+
21+
-- main file (i.e. file to load at REPL)
22+
-- main =
23+
24+
-- name of executable
25+
-- executable =
26+
-- opts =
27+
-- sourcedir =
28+
-- builddir =
29+
-- outputdir =
30+
31+
-- script to run before building
32+
-- prebuild =
33+
34+
-- script to run after building
35+
-- postbuild =
36+
37+
-- script to run after building, before installing
38+
-- preinstall =
39+
40+
-- script to run after installing
41+
-- postinstall =
42+
43+
-- script to run before cleaning
44+
-- preclean =
45+
46+
-- script to run after cleaning
47+
-- postclean =

0 commit comments

Comments
 (0)