Retourner au contenu associé (entrée de forum : Rust, Haskell, composition, monad et arrow)
Posté par tigrou3tac le 30 septembre 2019 à 16:39. En réponse au message Rust, Haskell, composition, monad et arrow. Évalué à 2.
Regarde du côté de Result
Ca peut donner quelque chose du genre let img = preprocessing(input) // prepocessing: fn(input) -> img1 .and_then(traitement1) // traitement1: fn(img1) -> img2 .and_then(traitement2) // traitement2: fn(img2) -> i .and_then(traitement3) // traitement3: fn(i) -> (i, img3) .and_then(traitement4)?; // traitement4: fn((i, img3) -> img4
let img = preprocessing(input) // prepocessing: fn(input) -> img1 .and_then(traitement1) // traitement1: fn(img1) -> img2 .and_then(traitement2) // traitement2: fn(img2) -> i .and_then(traitement3) // traitement3: fn(i) -> (i, img3) .and_then(traitement4)?; // traitement4: fn((i, img3) -> img4
Si tu es aventureux, tu peux regarder sur crates.io s'il n'y a pas des crates fournissant ces monades.
Et en règle générale, il n'est pas recommandé d'écrire du Rust en pensant aux idiomes d'un autre langage.
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
# Quelques idées
Posté par tigrou3tac . En réponse au message Rust, Haskell, composition, monad et arrow. Évalué à 2.
Regarde du côté de Result
Ca peut donner quelque chose du genre
let img = preprocessing(input) // prepocessing: fn(input) -> img1
.and_then(traitement1) // traitement1: fn(img1) -> img2
.and_then(traitement2) // traitement2: fn(img2) -> i
.and_then(traitement3) // traitement3: fn(i) -> (i, img3)
.and_then(traitement4)?; // traitement4: fn((i, img3) -> img4
Si tu es aventureux, tu peux regarder sur crates.io s'il n'y a pas des crates fournissant ces monades.
Et en règle générale, il n'est pas recommandé d'écrire du Rust en pensant aux idiomes d'un autre langage.