little_ferris@programming.dev to Rust@programming.devEnglish · edit-221 days agoWhat are some mind blowing Rust tricks?message-squaremessage-square47fedilinkarrow-up11arrow-down10file-text
arrow-up11arrow-down1message-squareWhat are some mind blowing Rust tricks?little_ferris@programming.dev to Rust@programming.devEnglish · edit-221 days agomessage-square47fedilinkfile-text
If we were to create a Rust version of this page for Haskell, what cool programming techniques would you add to it?
minus-squarebarsoap@lemm.eelinkfedilinkarrow-up0·20 days agoEnum constructors are functions, this typechecks: fn foo<T>() { let f: fn(T) -> Option<T> = Some; } I was a bit apprehensive because rust has like a gazillion different function types but here it seems to work like just any other language with a HM type system.
minus-squarelittle_ferris@programming.devOPlinkfedilinkEnglisharrow-up0·20 days agoWoah. That’s quite interesting. I didn’t know that.
Enum constructors are functions, this typechecks:
fn foo<T>() { let f: fn(T) -> Option<T> = Some; }
I was a bit apprehensive because rust has like a gazillion different function types but here it seems to work like just any other language with a HM type system.
Woah. That’s quite interesting. I didn’t know that.