Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Trait implementation #6

Open
J3RN opened this issue Nov 26, 2024 · 0 comments
Open

Add Trait implementation #6

J3RN opened this issue Nov 26, 2024 · 0 comments

Comments

@J3RN
Copy link
Owner

J3RN commented Nov 26, 2024

Again, Haskell has rather bad syntax for this:

instance Show Bool where
  show True -> "True"
  show False -> "False"

Rust:

impl Show for Bool {
  fn show(b) -> String {
     match (b) {
       true -> "true"
       false -> "false"
     }
   }
}

I think Rust's is closer to what I want when the extraneous parts are cut out:

impl Show for Bool {
  show = (b) => {
    match (b) {
      True -> "True"
      False -> "False"
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant