aboutsummaryrefslogtreecommitdiff
path: root/documentation/tour/traits.sloth
diff options
context:
space:
mode:
authorCody <cody@codyq.dev>2023-06-26 23:54:29 -0500
committerCody <cody@codyq.dev>2023-06-26 23:54:29 -0500
commit6e168a091d13b5ebb0beb7bb93c2b8c6f6d92711 (patch)
tree5353261c5eaf66031781e5e01d1b7409b66f50e4 /documentation/tour/traits.sloth
parent9748e95027af7820e6d9f08eb20b0901fdedfa2a (diff)
downloadsloth-6e168a091d13b5ebb0beb7bb93c2b8c6f6d92711.tar.gz
Deleted documentation directory
Diffstat (limited to 'documentation/tour/traits.sloth')
-rw-r--r--documentation/tour/traits.sloth34
1 files changed, 0 insertions, 34 deletions
diff --git a/documentation/tour/traits.sloth b/documentation/tour/traits.sloth
deleted file mode 100644
index 80319de..0000000
--- a/documentation/tour/traits.sloth
+++ /dev/null
@@ -1,34 +0,0 @@
-# Much like Rust's traits or Haskell's type classes sloth uses a trait system for
-# polymorphism.
-trait BasicTrait {
- fn add() -> i32;
-}
-
-trait AddAssign: Add {
- fn add_assign(value: i32, rhs: i32) -> i32;
-}
-
-trait Add {
- fn add(lhs: i32, rhs: i32) -> i32;
-
- default impl AddAssign {
- fn add_assign(value: i32, rhs: i32) -> i32 {
- return add(value, rhs);
- }
- }
-}
-
-# In order to make implementing traits easier you can automatically derive traits.
-# Types will implicitly derive from Debug, Copy, Eq and Ord if possible.
-type Person = {
- name: String,
- age: i32,
- hobbies: Set<String>,
-};
-
-# You can easily derive from more traits using the `derive` keyword.
-type Person derives Serialize, Deserialize = {
- name: String,
- age: i32,
- hobbies: Set<String>,
-};