GitHub will be the "main" directory from which we will be working for this example. Any folder is fine, as long as this repo and the one you create are in the same place.
- Clone repo in
GitHub/petri-app-land
- From
GitHub
, typestack new YourProjectName petri-app-land/petriappland
to create a new PetriAppLand project (remember to changeYourProjectName
to whatever you want). This will create a folderGitHub/YourProjectName
. - Open
src/ClientServerSpec.hs
- Modify your specification how you please, adding types, places, transitions, etc.
- Types for the specification are in
src/Types.hs
- Type helper functions are in
src/TypeHelpers.hs
- From
YourProjectName
, runstack build
. Fix any compiler errors you may have with your specification, and rebuild. - When it compiled successfully (you get no errors), run
stack exec YourProjectName-exe
.- This will attempt to generate code based on your specification.
- If errors are found, you'll have to fix them, rebuild and execute again.
- Once the specification generates successfully,
cd YourProjectName
into the output folder you set in your ClientServerSpec.hs in step 3. Inside you'll seeclient
andserver
.
- Go into the client directory with
cd client
. - For each Net that you generated, you'll need to complete
Init.elm
,Update.elm
and all of the views in theView
folder.- All files in
Static
directories can be used for reference but should not be edited! - No generated imports should be modified, but you can add new modules and import them, or import new libraries.
- Helper functions for models can be found in
Static/Helpers
.
- All files in
- From the
client
directory, runmake
to build, thenmake launch
to open your app inelm reactor
. Runningbuild/index.html
directly will not work from your local machine due to Elm's handling of URLs. - To publish live on a server, copy all files in
build
into the directory you want them on your webserver.
- Go into the server directory with
cd ../server
- For each Net generated, you'll need to complete
Init.hs
andUpdate.hs
.- All files in
Static
directories can be used for reference but should not be edited! - No generated imports should be modified, but you can add new modules and import them, or import new libraries.
- Helper functions for models can be found in
Static/Helpers
.
- All files in
- From the
server
directory, usestack build
to build your client. Then usestack exec server-exe
to launch the server. - To launch live on a server, clone the repository on your server, build the server there and run on an open port. You'll have to update the client's URL to point to the correct one.
To edit your specification, make changes to the spec in ClientServerSpec.hs
and then rebuild and execute the program. Note that any files the user is supposed to edit (views, updates) will NOT be rebuilt by the system if they already exist. If you haven't edited a certain file, you can delete it or move it before regenerating and it will be generated again. Otherwise, you can use the compiler errors to help you fix your code. S
Static files will be rebuilt if there are changes, so don't edit them as you will lose work from them.
When you generate your code, you will be given the code to generate codegraphs with dot
. Either run them through dot, or use the
following website: https://dreampuf.github.io/GraphvizOnline/. Copy the code from the dot file in MyNewPetriProject/Diagrams/
into
the website to preview it.