Skip to content

A peer-to-peer stack for code collaboration

Fix basics tutorial check (#293)

Merle Breitkreuz425520aaef42
diff --git a/cloudbuild.yaml b/cloudbuild.yaml
index 0f7373e..dcc139d 100644
--- a/cloudbuild.yaml
+++ b/cloudbuild.yaml
@@ -74,6 +74,19 @@ steps:
exit 1
fi
+ - id: "Check tutorial"
+ waitFor:
+ - "Build & Test"
+ name: 'haskell:8.4.3'
+ env: ['STACK_ROOT=/workspace/.stack']
+ entrypoint: bash
+ args:
+ - '-c'
+ - |
+ set -euxo pipefail
+
+ stack exec radicle-doc docs/source/guide/Basics.lrad
+
- id: "Build radicle-server image"
waitFor:
- "Build & Test"
diff --git a/docs/source/guide/Basics.lrad b/docs/source/guide/Basics.lrad
index 866d680..ecd61f0 100644
--- a/docs/source/guide/Basics.lrad
+++ b/docs/source/guide/Basics.lrad
@@ -148,7 +148,7 @@ You can access the value associated with a key with the function `lookup`:
And add new values with `insert`:
```radicle
-(insert :key2 2 { :key1 1 }) ==> { :key1 1 :key2 2 }
+(insert :key2 2 { :key1 1 }) ;; ==> { :key1 1 :key2 2 }
```
## Simple expressions
@@ -158,18 +158,20 @@ And add new values with `insert`:
To dispatch on a boolean value use `if`:
```radicle
-(if (pr-accepted? pr)
- (merge-pr master pr)
- (close-pr pr))
+(def num-bugs 50)
+
+(if (> num-bugs 0)
+ "Oh no, so many bugs!"
+ "All done!")
```
To test multiple booleans use `cond`:
```radicle
(cond
- (> num-issues 100) "Oh no, so many bugs!"
- (= num-issues 0) "All done!"
- #t "A few bugs.")
+ (> num-bugs 100) "Oh no, so many bugs!"
+ (eq? num-bugs 0) "All done!"
+ #t "A few bugs.")
```
In fact _all_ values which are not `#f` are treated as true, so one can also
@@ -177,8 +179,8 @@ write:
```radicle
(cond
- (> num-issues 100) "Oh no, so many bugs!"
- (= num-issues 0) "All done!"
+ (> num-bugs 100) "Oh no, so many bugs!"
+ (eq? num-bugs 0) "All done!"
:else "A few bugs.")
```
diff --git a/exe/Doc.hs b/exe/Doc.hs
index 50d336c..de4f788 100644
--- a/exe/Doc.hs
+++ b/exe/Doc.hs
@@ -7,7 +7,6 @@ import Protolude
import qualified Data.Text as T
import Options.Applicative
import Radicle
-import System.Console.Haskeline (defaultSettings, runInputT)
import Text.Pandoc
main :: IO ()
@@ -24,8 +23,10 @@ main = do
run :: FilePath -> IO ()
run f = do
txt <- readFile f
- pand <- runIOorExplode $ readMarkdown def txt
- res <- runInputT defaultSettings $ runLang replBindings $ interpretMany (toS f) $ getCode pand
+ let extensions = def { readerExtensions = githubMarkdownExtensions }
+ pand <- runIOorExplode $ readMarkdown extensions txt
+ let code = T.append "(load! \"rad/prelude.rad\")" (getCode pand)
+ res <- runLang replBindings $ interpretMany (toS f) $ code
case res of
(Left err, _) -> die . toS $ "Error: " ++ show err
_ -> pure ()
diff --git a/package.yaml b/package.yaml
index 30fefdc..452936f 100644
--- a/package.yaml
+++ b/package.yaml
@@ -155,7 +155,6 @@ executables:
buildable: false
dependencies:
- radicle
- - haskeline
- optparse-applicative
- pandoc
- text