Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions src/lib/prelude.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
# Prelude

The `Prelude` module is automatically imported and opened in all programs.

### Available functions:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why skip a header level like this? Also, the title shouldn't end with ":" and should probably be in title case.


---
`flip f` returns function with flipped arguments
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the documentation would be more usable if each entry started with a codeblock with a particular function's scheme.

The descriptions following that should probably be in the form of sentences, with full stops and capitalization when applicable.


`flip f x y = f y x`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When a paragraph consists of a single piece of inline code then it should probably be a codeblock.


---
`fst p` returns first element of a pair `p`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many of these descriptions are missing articles, like "the first element".


`fst (x, _) = x`

---
`snd p` returns second element of a pair `p`

`snd (_, y) = y`

---
`not b` negates boolean value `b`

---
`charListToStr xs` converts list of characters `xs` into `String`

---
`chr n` converts integer `n` to corresponding ASCII character (`0 <= n <= 256` to work properly)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First of all, typo in the range. Should be n < 256. Second, what happens if it isn't? The bit about "to work properly" is too vague.


---
`printStrLn`

---
`printStr`

---
`printInt` prints integer

---
`readLine` reads line of input, returns `String`

---
`exit`